<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of VMT</title>
  <meta name="keywords" content="VMT">
  <meta name="description" content="--- THE VELOCITY MAPPING TOOLBOX ---">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- menu.html trunk -->
<h1>VMT
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>--- THE VELOCITY MAPPING TOOLBOX ---</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function varargout = VMT(varargin) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> --- THE VELOCITY MAPPING TOOLBOX ---
 
 VMT is a Matlab-based software for processing and visualizing ADCP data
 collected along transects in rivers or other bodies of water. VMT allows
 rapid processing, visualization, and analysis of a range of ADCP datasets
 and includes utilities to export ADCP data to files compatible with
 ArcGIS, Tecplot, and Google Earth. The software can be used to explore
 patterns of three-dimensional fluid motion through several methods for
 calculation of secondary flows (e.g. Rhoads and Kenworthy, 1998; Lane et
 al., 2000). The software also includes capabilities for analyzing the
 acoustic backscatter and bathymetric data from the ADCP. A user-friendly
 graphical user interface (GUI) enhances program functionality and
 provides ready access to two- and three- dimensional plotting functions,
 allowing rapid display and interrogation of velocity, backscatter, and
 bathymetry data.
 
 CITATION: 
 Parsons, D. R., Jackson, P. R., Czuba, J. A., Engel, F. L., Rhoads, B.
 L., Oberg, K. A., Best, J. L., Mueller, D. S., Johnson, K. K. and Riley,
 J. D. (2013), Velocity Mapping Toolbox (VMT): a processing and
 visualization suite for moving-vessel ADCP measurements. Earth Surf.
 Process. Landforms. doi: 10.1002/esp.3367

__________________________________________________________________________
 P.R. Jackson, U.S. Geological Survey, Illinois Water Science Center
 (pjackson@usgs.gov)

 Code contributed by D. Parsons, D. Mueller, J. Czuba, and F. Engel.
__________________________________________________________________________</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="VMT_BuildTecplotFile.html" class="code" title="function VMT_BuildTecplotFile(V,savefile)">VMT_BuildTecplotFile</a>	Takes the processed data structure and writes a TecPlot ASCII data file.</li><li><a href="VMT_BuildTecplotFile_XSBathy.html" class="code" title="function VMT_BuildTecplot_XSBathy(V,savefile)">VMT_BuildTecplotFile_XSBathy</a>	Takes the processed data structure and writes a TecPlot ASCII data file</li><li><a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>	Computes the layer averaged mean of y over the depth range.</li><li><a href="VMT_MBBathy.html" class="code" title="function [A] = VMT_MBBathy(z,A,savefile,beamAng,magVar,wsedata,saveaux)">VMT_MBBathy</a>	Computes the multibeam bathymetry from the four beams of the ADCP</li><li><a href="VMT_MeanXS2GE_3D.html" class="code" title="function VMT_MeanXS2GE_3D(A,V,pathstr,filestr,vscale,voffset)">VMT_MeanXS2GE_3D</a>	Outputs the mean cross section (3-D) from VMT to Google Earth (saved as a</li><li><a href="VMT_OverlayDOQQ.html" class="code" title="function [guiprefs,log_text] = VMT_OverlayDOQQ(guiprefs,varargin)">VMT_OverlayDOQQ</a>	Prompts the user for a geotiff DOQQ (USGS) and overlays the aerial image</li><li><a href="VMT_PlotPlanViewQuivers.html" class="code" title="function [PVdata,fig_planview_handle,log_text] = VMT_PlotPlanViewQuivers(z,A,V,Map,drng,ascale,QuiverSpacing,pvsmwin,pshore,plot_english,varargin)">VMT_PlotPlanViewQuivers</a>	This function plots a plan view of the measurement region with a vector</li><li><a href="VMT_PlotShiptracks.html" class="code" title="function hf = VMT_PlotShiptracks(A,V,z,setends,hf)">VMT_PlotShiptracks</a>	Plots the shiptracks, and interpolated grid in the VMT GUI axes. Also</li><li><a href="VMT_PlotShoreline.html" class="code" title="function VMT_PlotShoreline(Map)">VMT_PlotShoreline</a>	Plots a shoreline map given the shoreline data structure 'Map' (see</li><li><a href="VMT_PlotXSCont.html" class="code" title="function [z,A,V,zmin,zmax,log_text,fig_contour_handle] = VMT_PlotXSCont(z,A,V,var,exag,plot_english)">VMT_PlotXSCont</a>	Plots contours for the variable 'var' within the mean cross section given</li><li><a href="VMT_PlotXSContQuiver.html" class="code" title="function [z,A,V,log_text] = VMT_PlotXSContQuiver(z,A,V,var,sf,exag,qspchorz,qspcvert,secvecvar,vvelcomp,plot_english,varargin)">VMT_PlotXSContQuiver</a>	This function plots the the contour plot (mean XS) for the variable 'var'</li><li><a href="VMT_PreProcess.html" class="code" title="function A = VMT_PreProcess(z,A)">VMT_PreProcess</a>	This function is a driver to preprocess the transects data.  Several</li><li><a href="VMT_ProcessTransects.html" class="code" title="function [A,V,log_text] = VMT_ProcessTransects(z,A,setends,unitQcorrection)">VMT_ProcessTransects</a>	Driver program to process multiple transects at a single cross-section</li><li><a href="VMT_ReadFiles.html" class="code" title="function [zPathName,zFileName,savefile,A,z] = VMT_ReadFiles(zPathName,zFileName)">VMT_ReadFiles</a>	Read in multiple ASCII output files from WinRiver or WinRiverII.</li><li><a href="VMT_ReadFiles_SonTek.html" class="code" title="function [zPathName,zFileName,savefile,A,z] = VMT_ReadFiles_SonTek(zPathName,zFileName)">VMT_ReadFiles_SonTek</a>	Read in multiple MAT output files from SonTek RSL v1.5-3.60.</li><li><a href="VMT_SaveFigs.html" class="code" title="function VMT_SaveFigs(pathname,to_export,figure_style)">VMT_SaveFigs</a>	Saves the figures (specified by fignums) from VMT as .PNG or EPS files</li><li><a href="VMT_SmoothVar.html" class="code" title="function [V] = VMT_SmoothVar(V,hwin,vwin)">VMT_SmoothVar</a>	This routine smooths all processed variables in V struct. By default is</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->

<h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="#_sub1" class="code">function VMT_OpeningFcn(hObject, eventdata, handles, varargin)</a></li><li><a href="#_sub2" class="code">function varargout = VMT_OutputFcn(hObject, eventdata, handles)</a></li><li><a href="#_sub3" class="code">function figure1_ResizeFcn(hObject, eventdata, handles)</a></li><li><a href="#_sub4" class="code">function figure1_CloseRequestFcn(hObject, eventdata, handles)</a></li><li><a href="#_sub5" class="code">function menuFile_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub6" class="code">function menuOpen_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub7" class="code">function menuOpenASCII_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub8" class="code">function menuOpenMAT_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub9" class="code">function menuSave_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub10" class="code">function menuSaveMAT_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub11" class="code">function menuSaveTecplot_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub12" class="code">function menuSaveKMZFile_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub13" class="code">function menuExport_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub14" class="code">function menuFigureExportsettings_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub15" class="code">function menuPrintFormat_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub16" class="code">function menuPresentationFormat_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub17" class="code">function menuGraphicsRenderer_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub18" class="code">function menuOpenGL_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub19" class="code">function menuPainters_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub20" class="code">function menuZbuffer_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub21" class="code">function menuExportFigures_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub22" class="code">function menuBathymetryExportSettings_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub23" class="code">function menuExportMultibeamBathymetry_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub24" class="code">function menuSaveANVFile_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub25" class="code">function menuSaveExcel_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub26" class="code">function menuParameters_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub27" class="code">function menuProcessingParameters_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub28" class="code">function menuUnitDischargeCorrection_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub29" class="code">function menuPlottingParameters_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub30" class="code">function menuUnits_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub31" class="code">function menuMetric_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub32" class="code">function menuEnglish_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub33" class="code">function menuSetCrossSectionEndpoints_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub34" class="code">function menuCrossSectionEndpointAutomatic_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub35" class="code">function menuCrossSectionEndpointManual_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub36" class="code">function menuPlotStyle_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub37" class="code">function menuStylePrint_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub38" class="code">function menuStylePresentation_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub39" class="code">function menuKMZVerticalOffset_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub40" class="code">function menuBathymetryParameters_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub41" class="code">function menuTools_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub42" class="code">function menuASCII2GIS_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub43" class="code">function menuASCII2KML_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub44" class="code">function menuOpenBatchMode_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub45" class="code">function menuHelp_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub46" class="code">function menuUsersGuide_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub47" class="code">function menuFunctionLibrary_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub48" class="code">function menuCheckForUpdates_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub49" class="code">function menuAbout_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub50" class="code">function loadDataCallback(hObject, eventdata, handles)</a></li><li><a href="#_sub51" class="code">function saveDataCallback(hObject, eventdata, handles)</a></li><li><a href="#_sub52" class="code">function saveBathymetryCallback(hObject, eventdata, handles)</a></li><li><a href="#_sub53" class="code">function plottingParametersCallback(hObject, eventdata, handles)</a></li><li><a href="#_sub54" class="code">function processingParametersCallback(hObject, eventdata, handles)</a></li><li><a href="#_sub55" class="code">function shiptracksPlotCallback(hObject, eventdata, handles)</a></li><li><a href="#_sub56" class="code">function planviewPlotCallback(hObject, eventdata, handles)</a></li><li><a href="#_sub57" class="code">function crosssectionPlotCallback(hObject, eventdata, handles)</a></li><li><a href="#_sub58" class="code">function SaveMATFile_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub59" class="code">function SaveTecplotFile_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub60" class="code">function SaveGoogleEarthFile_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub61" class="code">function ExportMultibeamBathymetry_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub62" class="code">function BeamAngle_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub63" class="code">function MagneticVariation_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub64" class="code">function WSE_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub65" class="code">function OutputAuxiliaryData_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub66" class="code">function DepthRangeMin_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub67" class="code">function DepthRangeMax_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub68" class="code">function VectorScalePlanView_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub69" class="code">function VectorSpacingPlanview_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub70" class="code">function SmoothingWindowSize_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub71" class="code">function DisplayShoreline_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub72" class="code">function AddBackground_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub73" class="code">function PlotPlanView_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub74" class="code">function HorizontalGridNodeSpacing_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub75" class="code">function VerticalGridNodeSpacing_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub76" class="code">function SetCrossSectionEndpoints_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub77" class="code">function PlotShiptracks_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub78" class="code">function Contour_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub79" class="code">function VerticalExaggeration_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub80" class="code">function VectorScaleCrossSection_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub81" class="code">function HorizontalVectorSpacing_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub82" class="code">function VerticalVectorSpacing_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub83" class="code">function HorizontalSmoothingWindow_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub84" class="code">function VerticalSmoothingWindow_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub85" class="code">function PlotSecondaryFlowVectors_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub86" class="code">function SecondaryFlowVectorVariable_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub87" class="code">function IncludeVerticalVelocity_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub88" class="code">function PlotCrossSection_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub89" class="code">function ClearLog_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub90" class="code">function SaveLog_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub91" class="code">function handles = buildToolbar(handles)</a></li><li><a href="#_sub92" class="code">function load_prefs(hfigure)</a></li><li><a href="#_sub93" class="code">function store_prefs(hfigure,pref)</a></li><li><a href="#_sub94" class="code">function initGUI(handles)</a></li><li><a href="#_sub95" class="code">function set_enable(handles,enable_state)</a></li><li><a href="#_sub96" class="code">function [english_units,set_cross_section_endpoints,plot_presentation_style,plot_print_style] =</a></li><li><a href="#_sub97" class="code">function dialogUnits(hObject,eventdata,handles,the_units)</a></li><li><a href="#_sub98" class="code">function dialogEnpoints(hObject,eventdata,handles,the_endpoints)</a></li><li><a href="#_sub99" class="code">function dialogPlotStyle(hObject,eventdata,handles,the_style)</a></li><li><a href="#_sub100" class="code">function dialogOK(hObject,eventdata,h_OK)</a></li><li><a href="#_sub101" class="code">function dialogCancel(hObject,eventdata,handles)</a></li><li><a href="#_sub102" class="code">function dialogCloseReq(hObject,eventdata,h_OK)</a></li><li><a href="#_sub103" class="code">function [beam_angle,magnetic_variation,wse,output_auxiliary_data] = exportSettingsDialog(beam_angle,magnetic_variation,wse,output_auxiliary_data,hf)</a></li><li><a href="#_sub104" class="code">function dialogExportSettings(hObject,eventdata,handles)</a></li><li><a href="#_sub105" class="code">function [selected_figures] = openFiguresDialog(figure_names,hf)</a></li><li><a href="#_sub106" class="code">function dialogSelectFigures(hObject,eventdata,handles)</a></li><li><a href="#_sub107" class="code">function icons = getIcons</a></li><li><a href="#_sub108" class="code">function guiparams = createGUIparams</a></li><li><a href="#_sub109" class="code">function ShiptracksZoom_Callback(obj,evd,handles)</a></li><li><a href="#_sub110" class="code">function ShiptracksPan_Callback(obj,evd,handles)</a></li><li><a href="#_sub111" class="code">function figure1_WindowKeyPressFcn(hObject, eventdata, handles)</a></li></ul>

<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function varargout = VMT(varargin)</a>
0002 <span class="comment">% --- THE VELOCITY MAPPING TOOLBOX ---</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% VMT is a Matlab-based software for processing and visualizing ADCP data</span>
0005 <span class="comment">% collected along transects in rivers or other bodies of water. VMT allows</span>
0006 <span class="comment">% rapid processing, visualization, and analysis of a range of ADCP datasets</span>
0007 <span class="comment">% and includes utilities to export ADCP data to files compatible with</span>
0008 <span class="comment">% ArcGIS, Tecplot, and Google Earth. The software can be used to explore</span>
0009 <span class="comment">% patterns of three-dimensional fluid motion through several methods for</span>
0010 <span class="comment">% calculation of secondary flows (e.g. Rhoads and Kenworthy, 1998; Lane et</span>
0011 <span class="comment">% al., 2000). The software also includes capabilities for analyzing the</span>
0012 <span class="comment">% acoustic backscatter and bathymetric data from the ADCP. A user-friendly</span>
0013 <span class="comment">% graphical user interface (GUI) enhances program functionality and</span>
0014 <span class="comment">% provides ready access to two- and three- dimensional plotting functions,</span>
0015 <span class="comment">% allowing rapid display and interrogation of velocity, backscatter, and</span>
0016 <span class="comment">% bathymetry data.</span>
0017 <span class="comment">%</span>
0018 <span class="comment">% CITATION:</span>
0019 <span class="comment">% Parsons, D. R., Jackson, P. R., Czuba, J. A., Engel, F. L., Rhoads, B.</span>
0020 <span class="comment">% L., Oberg, K. A., Best, J. L., Mueller, D. S., Johnson, K. K. and Riley,</span>
0021 <span class="comment">% J. D. (2013), Velocity Mapping Toolbox (VMT): a processing and</span>
0022 <span class="comment">% visualization suite for moving-vessel ADCP measurements. Earth Surf.</span>
0023 <span class="comment">% Process. Landforms. doi: 10.1002/esp.3367</span>
0024 <span class="comment">%</span>
0025 <span class="comment">%__________________________________________________________________________</span>
0026 <span class="comment">% P.R. Jackson, U.S. Geological Survey, Illinois Water Science Center</span>
0027 <span class="comment">% (pjackson@usgs.gov)</span>
0028 <span class="comment">%</span>
0029 <span class="comment">% Code contributed by D. Parsons, D. Mueller, J. Czuba, and F. Engel.</span>
0030 <span class="comment">%__________________________________________________________________________</span>
0031 
0032 <span class="comment">% Begin initialization code - DO NOT EDIT</span>
0033 gui_Singleton = 1;
0034 gui_State = struct(<span class="string">'gui_Name'</span>,       mfilename, <span class="keyword">...</span>
0035     <span class="string">'gui_Singleton'</span>,  gui_Singleton, <span class="keyword">...</span>
0036     <span class="string">'gui_OpeningFcn'</span>, @<a href="#_sub1" class="code" title="subfunction VMT_OpeningFcn(hObject, eventdata, handles, varargin)">VMT_OpeningFcn</a>, <span class="keyword">...</span>
0037     <span class="string">'gui_OutputFcn'</span>,  @<a href="#_sub2" class="code" title="subfunction varargout = VMT_OutputFcn(hObject, eventdata, handles)">VMT_OutputFcn</a>, <span class="keyword">...</span>
0038     <span class="string">'gui_LayoutFcn'</span>,  [] , <span class="keyword">...</span>
0039     <span class="string">'gui_Callback'</span>,   []);
0040 <span class="keyword">if</span> nargin &amp;&amp; ischar(varargin{1})
0041     gui_State.gui_Callback = str2func(varargin{1});
0042 <span class="keyword">end</span>
0043 
0044 <span class="comment">% If ERROR, write a txt file with the error dump info</span>
0045 <span class="keyword">try</span>
0046 <span class="keyword">if</span> nargout
0047     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0048 <span class="keyword">else</span>
0049     gui_mainfcn(gui_State, varargin{:});
0050 <span class="keyword">end</span>
0051 
0052 <span class="keyword">catch</span> err
0053     <span class="keyword">if</span> isdeployed
0054         errLogFileName = fullfile(pwd,<span class="keyword">...</span>
0055             [<span class="string">'errorLog'</span> datestr(now,<span class="string">'yyyymmddHHMMSS'</span>) <span class="string">'.txt'</span>]);
0056         msgbox({[<span class="string">'An unexpected error occurred. Error code: '</span> err.identifier];<span class="keyword">...</span>
0057             [<span class="string">'Error details are being written to the following file: '</span>];<span class="keyword">...</span>
0058             errLogFileName},<span class="keyword">...</span>
0059             <span class="string">'VMT Status: Unexpected Error'</span>,<span class="keyword">...</span>
0060             <span class="string">'error'</span>);
0061         fid = fopen(errLogFileName,<span class="string">'W'</span>);
0062         fwrite(fid,err.getReport(<span class="string">'extended'</span>,<span class="string">'hyperlinks'</span>,<span class="string">'off'</span>));
0063         fclose(fid);
0064         rethrow(err)
0065     <span class="keyword">else</span>
0066         msgbox([<span class="string">'An unexpected error occurred. Error code: '</span> err.identifier],<span class="keyword">...</span>
0067             <span class="string">'VMT Status: Unexpected Error'</span>,<span class="keyword">...</span>
0068             <span class="string">'error'</span>);
0069         rethrow(err);
0070     <span class="keyword">end</span>
0071 <span class="keyword">end</span>
0072 <span class="comment">% End initialization code - DO NOT EDIT</span>
0073 
0074 <span class="comment">%#ok&lt;*DEFNU,*INUSL,*INUSD&gt;</span>
0075 
0076 <span class="comment">% --- Executes just before VMT is made visible.</span>
0077 <a name="_sub1" href="#_subfunctions" class="code">function VMT_OpeningFcn(hObject, eventdata, handles, varargin)</a>
0078 <span class="comment">% This function has no output args, see OutputFcn.</span>
0079 <span class="comment">% hObject    handle to figure</span>
0080 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
0081 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
0082 <span class="comment">% varargin   command line arguments to VMT (see VARARGIN)</span>
0083 
0084 <span class="comment">% Choose default command line output for VMT</span>
0085 handles.output = hObject;
0086 
0087 <span class="comment">% Build the GUI toolbar:</span>
0088 <span class="comment">% ----------------------</span>
0089 handles = <a href="#_sub91" class="code" title="subfunction handles = buildToolbar(handles)">buildToolbar</a>(handles);
0090 
0091 <span class="comment">% Ensure path to utils &amp; docs is available</span>
0092 <span class="comment">% ----------------------------------------</span>
0093 <span class="keyword">if</span> ~isdeployed
0094     filesep = <span class="string">'\'</span>; <span class="comment">% windows</span>
0095     utilspath = [pwd filesep <span class="string">'utils'</span>];
0096     docspath  = [pwd filesep <span class="string">'doc'</span>];
0097     toolspath = [pwd filesep <span class="string">'tools'</span>];
0098     addpath(utilspath,docspath,toolspath)
0099 <span class="keyword">end</span>
0100 
0101 <span class="comment">% Update handles structure</span>
0102 <span class="comment">% ------------------------</span>
0103 guidata(hObject, handles);
0104 
0105 <span class="comment">% Load the GUI preferences:</span>
0106 <span class="comment">% -------------------------</span>
0107 <a href="#_sub92" class="code" title="subfunction load_prefs(hfigure)">load_prefs</a>(handles.figure1)
0108 
0109 <span class="comment">% Initialize the GUI parameters:</span>
0110 <span class="comment">% ------------------------------</span>
0111 guiparams = <a href="#_sub108" class="code" title="subfunction guiparams = createGUIparams">createGUIparams</a>;
0112 guiparams.vmt_version = <span class="string">'v4.06'</span>;
0113 
0114 <span class="comment">% Draw the VMT Background</span>
0115 <span class="comment">% -----------------</span>
0116 pos = get(handles.figure1,<span class="string">'position'</span>);
0117 axes(handles.VMTBackground);
0118 <span class="comment">% if ~isdeployed %isempty(dir(fullfile(matlabroot,'toolbox','images')))</span>
0119     X = imread(<span class="string">'VMT_Background.png'</span>);
0120     imdisp(X,<span class="string">'size'</span>,[pos(4) pos(3)]) <span class="comment">% Avoids problems with users not having Image Processing TB</span>
0121 <span class="comment">% else</span>
0122 <span class="comment">%     X = imread('VMT_Background.png');</span>
0123 <span class="comment">%     X = imresize(X, [pos(4) pos(3)]);</span>
0124 <span class="comment">%     X = uint8(X);</span>
0125 <span class="comment">%     imshow(X,'Border','tight')</span>
0126 <span class="comment">% end</span>
0127 uistack(handles.VMTBackground,<span class="string">'bottom'</span>)
0128 
0129 <span class="comment">% Store the application data:</span>
0130 <span class="comment">% ---------------------------</span>
0131 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0132 
0133 <span class="comment">% Initialize the GUI:</span>
0134 <span class="comment">% -------------------</span>
0135 <a href="#_sub94" class="code" title="subfunction initGUI(handles)">initGUI</a>(handles)
0136 <a href="#_sub95" class="code" title="subfunction set_enable(handles,enable_state)">set_enable</a>(handles,<span class="string">'init'</span>)
0137 <span class="comment">% set(handles.GraphicsExportPanel,'Visible','off')</span>
0138 <span class="comment">% set(handles.ProcessingPanel,'Visible','off')</span>
0139 pos = get(handles.figure1,<span class="string">'Position'</span>);
0140 <span class="comment">% pos(3) = 545;</span>
0141 <span class="comment">% set(handles.figure1,'Position',pos)</span>
0142 movegui(handles.figure1,<span class="string">'center'</span>)
0143 set(handles.figure1,<span class="string">'Resize'</span>,<span class="string">'on'</span>)
0144 
0145 <span class="comment">% Allow access to the VMT Main GUI info by other sub-GUIs by pushing it to</span>
0146 <span class="comment">% the root</span>
0147 setappdata(0  , <span class="string">'hVMTgui'</span>    , gcf);
0148 
0149 <span class="comment">% UIWAIT makes VMT wait for user response (see UIRESUME)</span>
0150 <span class="comment">% uiwait(handles.figure1);</span>
0151 <span class="comment">% [EOF] VMT_OpeningFcn</span>
0152 
0153 
0154 <span class="comment">% --- Outputs from this function are returned to the command line.</span>
0155 <a name="_sub2" href="#_subfunctions" class="code">function varargout = VMT_OutputFcn(hObject, eventdata, handles)</a>
0156 <span class="comment">% varargout  cell array for returning output args (see VARARGOUT);</span>
0157 <span class="comment">% hObject    handle to figure</span>
0158 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
0159 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
0160 
0161 <span class="comment">% Get default command line output from handles structure</span>
0162 varargout{1} = handles.output;
0163 <span class="comment">% [EOF] VMT_OutputFcn</span>
0164 
0165 <span class="comment">% --- Executes when figure1 is resized.</span>
0166 <a name="_sub3" href="#_subfunctions" class="code">function figure1_ResizeFcn(hObject, eventdata, handles)</a>
0167 
0168 <span class="comment">% Draw the VMT Background</span>
0169 <span class="comment">% -----------------</span>
0170 pos = get(handles.figure1,<span class="string">'position'</span>);
0171 axes(handles.VMTBackground);
0172 <span class="comment">% if ~isdeployed %isempty(dir(fullfile(matlabroot,'toolbox','images')))</span>
0173     X = imread(<span class="string">'VMT_Background.png'</span>);
0174     imdisp(X,<span class="string">'size'</span>,[pos(4) pos(3)]) <span class="comment">% Avoids problems with users not having Image Processing TB</span>
0175 <span class="comment">% else</span>
0176 <span class="comment">%     X = imread('VMT_Background.png');</span>
0177 <span class="comment">%     X = imresize(X, [pos(4) pos(3)]);</span>
0178 <span class="comment">%     X = uint8(X);</span>
0179 <span class="comment">%     imshow(X,'Border','tight')</span>
0180 <span class="comment">% end</span>
0181 uistack(handles.VMTBackground,<span class="string">'bottom'</span>)
0182 
0183 <span class="comment">% --- Executes when user attempts to close figure1.</span>
0184 <a name="_sub4" href="#_subfunctions" class="code">function figure1_CloseRequestFcn(hObject, eventdata, handles)</a>
0185 <span class="comment">% hObject    handle to figure1 (see GCBO)</span>
0186 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
0187 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
0188 
0189 <span class="comment">% Hint: delete(hObject) closes the figure</span>
0190 close_button = questdlg(<span class="keyword">...</span>
0191     <span class="string">'You are about to exit VMT. Any unsaved work will be lost. Are you sure?'</span>,<span class="keyword">...</span>
0192     <span class="string">'Exit VMT?'</span>,<span class="string">'No'</span>);
0193 <span class="keyword">switch</span> close_button
0194     <span class="keyword">case</span> <span class="string">'Yes'</span>
0195         delete(hObject)
0196         close all hidden
0197     <span class="keyword">otherwise</span>
0198         <span class="keyword">return</span>
0199 <span class="keyword">end</span>
0200 <span class="comment">% [EOF] figure1_CloseRequestFcn</span>
0201 
0202 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%</span>
0203 <span class="comment">% MENU BAR CALLBACKS %</span>
0204 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%</span>
0205 
0206 <span class="comment">% --------------------------------------------------------------------</span>
0207 <a name="_sub5" href="#_subfunctions" class="code">function menuFile_Callback(hObject, eventdata, handles)</a>
0208 <span class="comment">% Empty</span>
0209 
0210 <span class="comment">% --------------------------------------------------------------------</span>
0211 <a name="_sub6" href="#_subfunctions" class="code">function menuOpen_Callback(hObject, eventdata, handles)</a>
0212 <span class="comment">% Empty</span>
0213 
0214 <span class="comment">% --------------------------------------------------------------------</span>
0215 <a name="_sub7" href="#_subfunctions" class="code">function menuOpenASCII_Callback(hObject, eventdata, handles)</a>
0216 <a href="#_sub50" class="code" title="subfunction loadDataCallback(hObject, eventdata, handles)">loadDataCallback</a>(hObject, eventdata, handles)
0217 <span class="comment">% [EOF] menuOpenASCII_Callback</span>
0218 
0219 <span class="comment">% --------------------------------------------------------------------</span>
0220 <a name="_sub8" href="#_subfunctions" class="code">function menuOpenMAT_Callback(hObject, eventdata, handles)</a>
0221 
0222 <span class="comment">% Get the Application data:</span>
0223 <span class="comment">% -------------------------</span>
0224 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0225 guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0226 
0227 <span class="comment">% Ask the user to select files:</span>
0228 <span class="comment">% -----------------------------</span>
0229 <span class="comment">% current_file = fullfile(guiparams.data_folder,guiparams.data_files{1});</span>
0230 <span class="comment">% current_file = fullfile(guiprefs.mat_path,guiprefs.mat_file);</span>
0231 <span class="keyword">if</span> iscell(guiprefs.mat_file)
0232     uifile = fullfile(guiprefs.mat_path,guiprefs.mat_file{1});
0233 <span class="keyword">else</span>
0234     uifile = fullfile(guiprefs.mat_path,guiprefs.mat_file);
0235 <span class="keyword">end</span>
0236 [filename,pathname] = <span class="keyword">...</span>
0237     uigetfile({<span class="string">'*.mat'</span>,<span class="string">'MAT-files (*.mat)'</span>}, <span class="keyword">...</span>
0238     <span class="string">'Select MAT File'</span>, <span class="keyword">...</span>
0239     uifile, <span class="string">'MultiSelect'</span>,<span class="string">'on'</span>);
0240 
0241 <span class="keyword">if</span> ischar(filename) <span class="comment">% Single MAT file loaded</span>
0242     <span class="comment">% Load the data:</span>
0243     <span class="comment">% --------------</span>
0244     vars = load(fullfile(pathname,filename));
0245     
0246     <span class="comment">% Make sure the selected file is a valid file:</span>
0247     <span class="comment">% --------------------------------------------</span>
0248     varnames = fieldnames(vars);
0249     <span class="keyword">if</span> isequal(sort(varnames),{<span class="string">'A'</span> <span class="string">'Map'</span> <span class="string">'V'</span> <span class="string">'z'</span>}')
0250         guiparams.mat_path = pathname;
0251         guiparams.mat_file = filename;
0252         guiparams.z = vars.z;
0253         guiparams.A = vars.A;
0254         guiparams.V = vars.V;
0255         
0256         <span class="comment">% Update the preferences:</span>
0257         <span class="comment">% -----------------------</span>
0258         guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0259         guiprefs.mat_path = pathname;
0260         guiprefs.mat_file = filename;
0261         setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
0262         <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'mat'</span>)
0263                      
0264         <span class="comment">% Re-store the Application Data:</span>
0265         <span class="comment">% ------------------------------</span>
0266         setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0267         
0268         <span class="comment">% Update the GUI:</span>
0269         <span class="comment">% ---------------</span>
0270         set(handles.HorizontalGridNodeSpacing,<span class="string">'String'</span>,vars.A(1).hgns)
0271         <a href="#_sub95" class="code" title="subfunction set_enable(handles,enable_state)">set_enable</a>(handles,<span class="string">'fileloaded'</span>)
0272     <span class="keyword">else</span> <span class="comment">% Not a valid file</span>
0273         errordlg(<span class="string">'The selected file is not a valid ADCP data MAT file.'</span>, <span class="keyword">...</span>
0274             <span class="string">'Invalid File...'</span>)
0275     <span class="keyword">end</span>
0276     
0277     <span class="comment">% Set the vertical grid node spacing</span>
0278     <span class="comment">% ----------------------------------</span>
0279     <span class="comment">% For RioGrande probes, use the bin size, else just use the default</span>
0280     <span class="comment">% Backwards compatible</span>
0281     <span class="keyword">if</span> vars.A(1).Sup.wm ~= 3 <span class="comment">% RG</span>
0282         set(handles.VerticalGridNodeSpacing,<span class="string">'String'</span>,double(vars.A(1).Sup.binSize_cm(1))/100)
0283     <span class="keyword">else</span> <span class="comment">% Older file, must be RG</span>
0284         set(handles.VerticalGridNodeSpacing,<span class="string">'String'</span>,0.4)
0285     <span class="keyword">end</span>
0286     
0287 <span class="keyword">elseif</span> iscell(filename) <span class="comment">% Multiple MAT files loaded</span>
0288     <span class="comment">% Set the filenames</span>
0289     <span class="comment">% -----------------</span>
0290     guiparams.mat_path = pathname;
0291     guiparams.mat_file = filename;
0292     
0293     <span class="comment">% Push status to log window</span>
0294     <span class="comment">% -------------------------</span>
0295     log_text = {<span class="keyword">...</span>
0296         <span class="string">'Loading previously processed MAT files.'</span>;<span class="keyword">...</span>
0297         <span class="string">'Directory:'</span>};
0298     log_text = vertcat(log_text, pathname, {<span class="string">'Files:'</span>}, filename');
0299     statusLogging(handles.LogWindow,log_text)
0300     
0301     <span class="comment">% Update the Application Data:</span>
0302     <span class="comment">% ------------------------------</span>
0303     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0304     
0305     <span class="comment">% Update the persistent preferences:</span>
0306     <span class="comment">% ----------------------------------</span>
0307     guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0308     guiprefs.mat_path = pathname;
0309     guiprefs.mat_file = filename;
0310     setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
0311     <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'mat'</span>)
0312         
0313     <span class="comment">% Update the GUI:</span>
0314     <span class="comment">% ---------------</span>
0315     <a href="#_sub95" class="code" title="subfunction set_enable(handles,enable_state)">set_enable</a>(handles,<span class="string">'multiplematfiles'</span>)
0316 <span class="keyword">end</span>
0317 
0318 <span class="comment">% [EOF] menuOpenMAT_Callback</span>
0319 
0320 <span class="comment">% --------------------------------------------------------------------</span>
0321 <a name="_sub9" href="#_subfunctions" class="code">function menuSave_Callback(hObject, eventdata, handles)</a>
0322 <span class="comment">% Empty</span>
0323 
0324 <span class="comment">% --------------------------------------------------------------------</span>
0325 <a name="_sub10" href="#_subfunctions" class="code">function menuSaveMAT_Callback(hObject, eventdata, handles)</a>
0326 <a href="#_sub51" class="code" title="subfunction saveDataCallback(hObject, eventdata, handles)">saveDataCallback</a>(hObject, eventdata, handles)
0327 <span class="comment">% [EOF] menuSaveMAT_Callback</span>
0328 
0329 <span class="comment">% --------------------------------------------------------------------</span>
0330 <a name="_sub11" href="#_subfunctions" class="code">function menuSaveTecplot_Callback(hObject, eventdata, handles)</a>
0331 <a href="#_sub59" class="code" title="subfunction SaveTecplotFile_Callback(hObject, eventdata, handles)">SaveTecplotFile_Callback</a>(handles,eventdata,handles)
0332 <span class="comment">% [EOF] menuSaveTecplot_Callback</span>
0333 
0334 <span class="comment">% --------------------------------------------------------------------</span>
0335 <a name="_sub12" href="#_subfunctions" class="code">function menuSaveKMZFile_Callback(hObject, eventdata, handles)</a>
0336 <a href="#_sub60" class="code" title="subfunction SaveGoogleEarthFile_Callback(hObject, eventdata, handles)">SaveGoogleEarthFile_Callback</a>(handles,eventdata,handles)
0337 <span class="comment">% [EOF] menuSaveKMZFile_Callback</span>
0338 
0339 <span class="comment">% --------------------------------------------------------------------</span>
0340 <a name="_sub13" href="#_subfunctions" class="code">function menuExport_Callback(hObject, eventdata, handles)</a>
0341 <span class="comment">% Empty</span>
0342 
0343 <span class="comment">% --------------------------------------------------------------------</span>
0344 <a name="_sub14" href="#_subfunctions" class="code">function menuFigureExportsettings_Callback(hObject, eventdata, handles)</a>
0345 <span class="comment">% Empty</span>
0346 
0347 <span class="comment">% --------------------------------------------------------------------</span>
0348 <a name="_sub15" href="#_subfunctions" class="code">function menuPrintFormat_Callback(hObject, eventdata, handles)</a>
0349 
0350 <span class="comment">% Get the Application Data:</span>
0351 <span class="comment">% -------------------------</span>
0352 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0353 
0354 <span class="comment">% Update the Application Data:</span>
0355 <span class="comment">% ----------------------------</span>
0356 guiparams.print        = true;
0357 guiparams.presentation = false;
0358 
0359 <span class="comment">% Re-store the Application data:</span>
0360 <span class="comment">% ------------------------------</span>
0361 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0362 
0363 <span class="comment">% Update the GUI:</span>
0364 <span class="comment">% ---------------</span>
0365 set(handles.menuPrintFormat,       <span class="string">'Checked'</span>,<span class="string">'on'</span>)
0366 set(handles.menuPresentationFormat,<span class="string">'Checked'</span>,<span class="string">'off'</span>)
0367 
0368 <span class="comment">% [EOF] menuPrintFormat_Callback</span>
0369 
0370 
0371 <span class="comment">% --------------------------------------------------------------------</span>
0372 <a name="_sub16" href="#_subfunctions" class="code">function menuPresentationFormat_Callback(hObject, eventdata, handles)</a>
0373 
0374 <span class="comment">% Get the Application Data:</span>
0375 <span class="comment">% -------------------------</span>
0376 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0377 
0378 <span class="comment">% Update the Application Data:</span>
0379 <span class="comment">% ----------------------------</span>
0380 guiparams.print        = false;
0381 guiparams.presentation = true;
0382 
0383 <span class="comment">% Re-store the Application data:</span>
0384 <span class="comment">% ------------------------------</span>
0385 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0386 
0387 <span class="comment">% Update the GUI:</span>
0388 <span class="comment">% ---------------</span>
0389 set(handles.menuPrintFormat,       <span class="string">'Checked'</span>,<span class="string">'off'</span>)
0390 set(handles.menuPresentationFormat,<span class="string">'Checked'</span>,<span class="string">'on'</span>)
0391 
0392 <span class="comment">% [EOF] menuPresentationFormat_Callback</span>
0393 
0394 <span class="comment">% --------------------------------------------------------------------</span>
0395 <a name="_sub17" href="#_subfunctions" class="code">function menuGraphicsRenderer_Callback(hObject, eventdata, handles)</a>
0396 <span class="comment">%  --- Empty ---</span>
0397 
0398 <span class="comment">% --------------------------------------------------------------------</span>
0399 <a name="_sub18" href="#_subfunctions" class="code">function menuOpenGL_Callback(hObject, eventdata, handles)</a>
0400 <span class="comment">% Get the Application Data:</span>
0401 <span class="comment">% -------------------------</span>
0402 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0403 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0404 
0405 <span class="comment">% Update the Application Data:</span>
0406 <span class="comment">% ----------------------------</span>
0407 guiparams.renderer  = <span class="string">'OpenGL'</span>;
0408 guiprefs.renderer   = <span class="string">'OpenGL'</span>;
0409 
0410 <span class="comment">% Re-store the Application data:</span>
0411 <span class="comment">% ------------------------------</span>
0412 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0413 setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
0414 <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'renderer'</span>)
0415 
0416 <span class="comment">% Update the GUI:</span>
0417 <span class="comment">% ---------------</span>
0418 set(handles.menuOpenGL,   <span class="string">'Checked'</span>,<span class="string">'on'</span>)
0419 set(handles.menuPainters, <span class="string">'Checked'</span>,<span class="string">'off'</span>)
0420 set(handles.menuZbuffer,  <span class="string">'Checked'</span>,<span class="string">'off'</span>)
0421 
0422 <span class="comment">% Modify the existing figures</span>
0423 <span class="comment">% ---------------------------</span>
0424 <span class="comment">% Find what plots exist already</span>
0425 hf = findobj(<span class="string">'type'</span>,<span class="string">'figure'</span>);
0426 valid_names = {<span class="string">'Plan View Map'</span>; <span class="string">'Mean Cross Section Contour'</span>};
0427 
0428 <span class="comment">% Loop through valid figures and adjust</span>
0429 <span class="comment">% -------------------------------------</span>
0430 <span class="keyword">if</span> ~isempty(hf) &amp;&amp;  any(ishandle(hf))
0431     <span class="keyword">for</span> i = 1:length(valid_names)
0432         <span class="comment">% Focus the figure</span>
0433         hff = findobj(<span class="string">'name'</span>,<span class="string">'Plan View Map'</span>);
0434         <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
0435             figure(hff)
0436             set(hff,<span class="string">'Renderer'</span>,guiparams.renderer)
0437         <span class="keyword">end</span>
0438         hff = findobj(<span class="string">'name'</span>,<span class="string">'Mean Cross Section Contour'</span>);
0439         <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
0440             figure(hff)
0441             set(hff,<span class="string">'Renderer'</span>,guiparams.renderer)
0442         <span class="keyword">end</span>
0443     <span class="keyword">end</span>
0444 <span class="keyword">end</span>
0445 <span class="comment">% [EOF] menuOpenGL_Callback</span>
0446 
0447 
0448 <span class="comment">% --------------------------------------------------------------------</span>
0449 <a name="_sub19" href="#_subfunctions" class="code">function menuPainters_Callback(hObject, eventdata, handles)</a>
0450 <span class="comment">% Get the Application Data:</span>
0451 <span class="comment">% -------------------------</span>
0452 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0453 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0454 
0455 <span class="comment">% Update the Application Data:</span>
0456 <span class="comment">% ----------------------------</span>
0457 guiparams.renderer  = <span class="string">'painters'</span>;
0458 guiprefs.renderer   = <span class="string">'painters'</span>;
0459 
0460 <span class="comment">% Re-store the Application data:</span>
0461 <span class="comment">% ------------------------------</span>
0462 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0463 setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
0464 <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'renderer'</span>)
0465 
0466 <span class="comment">% Update the GUI:</span>
0467 <span class="comment">% ---------------</span>
0468 set(handles.menuOpenGL,   <span class="string">'Checked'</span>,<span class="string">'off'</span>)
0469 set(handles.menuPainters, <span class="string">'Checked'</span>,<span class="string">'on'</span>)
0470 set(handles.menuZbuffer,  <span class="string">'Checked'</span>,<span class="string">'off'</span>)
0471 
0472 <span class="comment">% Modify the existing figures</span>
0473 <span class="comment">% ---------------------------</span>
0474 <span class="comment">% Find what plots exist already</span>
0475 hf = findobj(<span class="string">'type'</span>,<span class="string">'figure'</span>);
0476 valid_names = {<span class="string">'Plan View Map'</span>; <span class="string">'Mean Cross Section Contour'</span>};
0477 
0478 <span class="comment">% Loop through valid figures and adjust</span>
0479 <span class="comment">% -------------------------------------</span>
0480 <span class="keyword">if</span> ~isempty(hf) &amp;&amp;  any(ishandle(hf))
0481     <span class="keyword">for</span> i = 1:length(valid_names)
0482         <span class="comment">% Focus the figure</span>
0483         hff = findobj(<span class="string">'name'</span>,<span class="string">'Plan View Map'</span>);
0484         <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
0485             figure(hff)
0486             set(hff,<span class="string">'Renderer'</span>,guiparams.renderer)
0487         <span class="keyword">end</span>
0488         hff = findobj(<span class="string">'name'</span>,<span class="string">'Mean Cross Section Contour'</span>);
0489         <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
0490             figure(hff)
0491             set(hff,<span class="string">'Renderer'</span>,guiparams.renderer)
0492         <span class="keyword">end</span>
0493     <span class="keyword">end</span>
0494 <span class="keyword">end</span>
0495 <span class="comment">% [EOF] menuPainters_Callback</span>
0496 
0497 <span class="comment">% --------------------------------------------------------------------</span>
0498 <a name="_sub20" href="#_subfunctions" class="code">function menuZbuffer_Callback(hObject, eventdata, handles)</a>
0499 <span class="comment">% Get the Application Data:</span>
0500 <span class="comment">% -------------------------</span>
0501 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0502 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0503 
0504 <span class="comment">% Update the Application Data:</span>
0505 <span class="comment">% ----------------------------</span>
0506 guiparams.renderer  = <span class="string">'zbuffer'</span>;
0507 guiprefs.renderer   = <span class="string">'zbuffer'</span>;
0508 
0509 <span class="comment">% Re-store the Application data:</span>
0510 <span class="comment">% ------------------------------</span>
0511 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0512 setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
0513 <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'renderer'</span>)
0514 
0515 <span class="comment">% Update the GUI:</span>
0516 <span class="comment">% ---------------</span>
0517 set(handles.menuOpenGL,   <span class="string">'Checked'</span>,<span class="string">'off'</span>)
0518 set(handles.menuPainters, <span class="string">'Checked'</span>,<span class="string">'off'</span>)
0519 set(handles.menuZbuffer,  <span class="string">'Checked'</span>,<span class="string">'on'</span>)
0520 
0521 <span class="comment">% Modify the existing figures</span>
0522 <span class="comment">% ---------------------------</span>
0523 <span class="comment">% Find what plots exist already</span>
0524 hf = findobj(<span class="string">'type'</span>,<span class="string">'figure'</span>);
0525 valid_names = {<span class="string">'Plan View Map'</span>; <span class="string">'Mean Cross Section Contour'</span>};
0526 
0527 <span class="comment">% Loop through valid figures and adjust</span>
0528 <span class="comment">% -------------------------------------</span>
0529 <span class="keyword">if</span> ~isempty(hf) &amp;&amp;  any(ishandle(hf))
0530     <span class="keyword">for</span> i = 1:length(valid_names)
0531         <span class="comment">% Focus the figure</span>
0532         hff = findobj(<span class="string">'name'</span>,<span class="string">'Plan View Map'</span>);
0533         <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
0534             figure(hff)
0535             set(hff,<span class="string">'Renderer'</span>,guiparams.renderer)
0536         <span class="keyword">end</span>
0537         hff = findobj(<span class="string">'name'</span>,<span class="string">'Mean Cross Section Contour'</span>);
0538         <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
0539             figure(hff)
0540             set(hff,<span class="string">'Renderer'</span>,guiparams.renderer)
0541         <span class="keyword">end</span>
0542     <span class="keyword">end</span>
0543 <span class="keyword">end</span>
0544 <span class="comment">% [EOF] menuZbuffer_Callback</span>
0545 
0546 <span class="comment">% --------------------------------------------------------------------</span>
0547 <a name="_sub21" href="#_subfunctions" class="code">function menuExportFigures_Callback(hObject, eventdata, handles)</a>
0548 <span class="comment">% Get the Application data:</span>
0549 <span class="comment">% -------------------------</span>
0550 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0551 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0552 
0553 <span class="comment">% Find what plots exist already</span>
0554 fig_handles = findobj(<span class="string">'type'</span>,<span class="string">'figure'</span>);
0555 fig_names   = get(fig_handles,<span class="string">'name'</span>);
0556 
0557 <span class="comment">% Remove the VMT GUI as a valid figure in the list</span>
0558 [~, idx] = ismember({get(handles.figure1,<span class="string">'Name'</span>),<span class="string">'VMT_GraphicsControl'</span>}, fig_names);
0559 <span class="keyword">if</span> ~isempty(idx)
0560     fig_names(idx) = [];
0561 <span class="keyword">end</span>
0562 
0563 <span class="keyword">if</span> guiparams.presentation
0564     figure_style = <span class="string">'presentation'</span>;
0565 <span class="keyword">else</span>
0566     figure_style = <span class="string">'print'</span>;
0567 <span class="keyword">end</span>
0568 
0569 [selected_figures] = <a href="#_sub105" class="code" title="subfunction [selected_figures] = openFiguresDialog(figure_names,hf)">openFiguresDialog</a>(fig_names,handles.figure1);
0570 
0571 <span class="keyword">if</span> isempty(selected_figures) <span class="comment">% User pressed cancel</span>
0572     <span class="keyword">return</span>
0573 <span class="keyword">else</span>
0574     <span class="keyword">for</span> i = 1:length(selected_figures)
0575         <a href="VMT_SaveFigs.html" class="code" title="function VMT_SaveFigs(pathname,to_export,figure_style)">VMT_SaveFigs</a>(guiprefs.mat_path,selected_figures(i),figure_style)
0576     <span class="keyword">end</span>
0577 <span class="keyword">end</span>
0578 
0579 
0580 <span class="comment">% [EOF] menuExportFigures_Callback</span>
0581 
0582 <span class="comment">% --------------------------------------------------------------------</span>
0583 <a name="_sub22" href="#_subfunctions" class="code">function menuBathymetryExportSettings_Callback(hObject, eventdata, handles)</a>
0584 <span class="comment">% Get the Application data:</span>
0585 <span class="comment">% -------------------------</span>
0586 guiparams              = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0587 beam_angle             = guiparams.beam_angle; 
0588 magnetic_variation     = guiparams.magnetic_variation; 
0589 wse                    = guiparams.wse;
0590 output_auxiliary_data  = guiparams.output_auxiliary_data; 
0591 
0592 <span class="comment">% Open dialog and allow user to select settings</span>
0593 <span class="comment">% ---------------------------------------------</span>
0594 [beam_angle,<span class="keyword">...</span>
0595     magnetic_variation,<span class="keyword">...</span>
0596     wse,<span class="keyword">...</span>
0597     output_auxiliary_data] = <span class="keyword">...</span>
0598     <a href="#_sub103" class="code" title="subfunction [beam_angle,magnetic_variation,wse,output_auxiliary_data] = exportSettingsDialog(beam_angle,magnetic_variation,wse,output_auxiliary_data,hf)">exportSettingsDialog</a>(beam_angle,magnetic_variation,wse,output_auxiliary_data,handles.figure1);
0599 
0600 <span class="comment">% Re-store the Application data:</span>
0601 <span class="comment">% ------------------------------</span>
0602 guiparams.beam_angle            = beam_angle;
0603 guiparams.magnetic_variation    = magnetic_variation; 
0604 guiparams.wse                   = wse;
0605 guiparams.output_auxiliary_data = output_auxiliary_data;
0606 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0607 
0608 <span class="comment">% [EOF] menuExportSettings_Callback</span>
0609 
0610 <span class="comment">% --------------------------------------------------------------------</span>
0611 <a name="_sub23" href="#_subfunctions" class="code">function menuExportMultibeamBathymetry_Callback(hObject, eventdata, handles)</a>
0612 <a href="#_sub61" class="code" title="subfunction ExportMultibeamBathymetry_Callback(hObject, eventdata, handles)">ExportMultibeamBathymetry_Callback</a>(hObject, eventdata, handles);
0613 <span class="comment">% [EOF] menuExportMultibeamBathymetry_Callback</span>
0614 
0615 
0616 <span class="comment">% --------------------------------------------------------------------</span>
0617 <a name="_sub24" href="#_subfunctions" class="code">function menuSaveANVFile_Callback(hObject, eventdata, handles)</a>
0618 
0619 <span class="comment">% Get the Application Data:</span>
0620 <span class="comment">% -------------------------</span>
0621 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0622 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0623 PVdata    = guiparams.iric_anv_planview_data;
0624 iric_path = guiprefs.iric_path;
0625 iric_file = guiprefs.iric_file;
0626 
0627 <span class="comment">% Is there any planview data?</span>
0628 <span class="keyword">if</span> isempty(PVdata)
0629     <span class="comment">% Nothing to do, warn user</span>
0630     log_text = {<span class="string">'No planview plot data to export. User must Plot Plan View first.'</span>};
0631     warndlg(log_text{:},<span class="string">'Nothing to export'</span>)
0632 <span class="keyword">else</span>
0633     <span class="comment">% Save the planview data as output and to an *.anv file with spacing</span>
0634     <span class="comment">% and smoothing (for iRiC)</span>
0635     log_text = {<span class="string">'Exporting iRic formated ANV vector file...'</span>};
0636     [iric_file,iric_path] = uiputfile(<span class="string">'*.anv'</span>,<span class="string">'Save *.anv file'</span>,<span class="keyword">...</span>
0637         fullfile(iric_path,iric_file));
0638     
0639     <span class="keyword">if</span> ischar(iric_path) <span class="comment">% The user did not hit &quot;Cancel&quot;</span>
0640         outfile = fullfile(iric_path,iric_file);
0641         log_text = vertcat(log_text,{outfile});
0642         ofid   = fopen(outfile, <span class="string">'wt'</span>);
0643         outcount = fprintf(ofid,<span class="keyword">...</span>
0644             <span class="string">'%8.2f  %8.2f  %5.2f  %3.3f  %3.3f\n'</span>,PVdata.outmat);
0645         fclose(ofid);
0646     <span class="keyword">else</span>
0647         <span class="comment">% Return default iric_path and iric_file</span>
0648         iric_path = guiprefs.iric_path;
0649         iric_file = guiprefs.iric_file;
0650     <span class="keyword">end</span>
0651 <span class="keyword">end</span>
0652 
0653 <span class="comment">% Push messages to Log Window:</span>
0654 <span class="comment">% ----------------------------</span>
0655 statusLogging(handles.LogWindow, log_text)
0656 
0657 <span class="comment">% Store the persistent preferences:</span>
0658 <span class="comment">% ---------------------------------</span>
0659 guiprefs.iric_file = iric_file;
0660 guiprefs.iric_path = iric_path;
0661 setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
0662 <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'iric'</span>)
0663 
0664 <span class="comment">% [EOF] menuSaveANVFile_Callback</span>
0665 
0666 <span class="comment">% --------------------------------------------------------------------</span>
0667 <a name="_sub25" href="#_subfunctions" class="code">function menuSaveExcel_Callback(hObject, eventdata, handles)</a>
0668 <span class="comment">% Get the Application Data:</span>
0669 <span class="comment">% -------------------------</span>
0670 guiparams   = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0671 guiprefs    = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0672 excel_path  = guiprefs.excel_path;
0673 excel_file  = guiprefs.excel_file;
0674 
0675 <span class="comment">% Push messages to Log Window:</span>
0676 <span class="comment">% ----------------------------</span>
0677 log_text = {<span class="string">'Exporting Excel File (reprocessing dataset; this will create new plots)'</span>};
0678 statusLogging(handles.LogWindow, log_text)
0679 
0680 <span class="comment">% If there are multiple MAT files loaded, go ahead and export just the DAV</span>
0681 <span class="comment">% data.</span>
0682 <span class="keyword">if</span> iscell(guiparams.mat_file)
0683     <span class="comment">% Force VMT to reprocess before outputing Excel</span>
0684     <a href="#_sub56" class="code" title="subfunction planviewPlotCallback(hObject, eventdata, handles)">planviewPlotCallback</a>(hObject, eventdata, handles)
0685     <span class="comment">% Refresh the Application Data:</span>
0686     guiparams   = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0687     z           = guiparams.z;
0688     A           = guiparams.A;
0689     V           = guiparams.V;
0690     Map         = guiparams.Map;
0691     wse         = guiparams.wse;
0692     PVdata      = guiparams.iric_anv_planview_data;
0693     log_text = {<span class="string">'Writing data to Excel file...'</span>;<span class="keyword">...</span>
0694         <span class="string">'Multiple transected loaded. Will export Planview Data Only!'</span>};
0695     [excel_file,excel_path] = uiputfile(<span class="string">'*.xlsx'</span>,<span class="string">'Save *.xlsx file'</span>,<span class="keyword">...</span>
0696         fullfile(excel_path,excel_file));
0697     
0698     <span class="keyword">if</span> ischar(excel_path) <span class="comment">% The user did not hit &quot;Cancel&quot;</span>
0699         outfile = fullfile(excel_path,excel_file);
0700         <span class="comment">%log_text = vertcat(log_text,{outfile});</span>
0701         
0702     <span class="keyword">else</span>
0703         <span class="comment">% Return default excel_path and excel_file</span>
0704         excel_path = guiprefs.excel_path;
0705         excel_file = guiprefs.excel_file;
0706         outfile = fullfile(excel_path,excel_file);
0707         <span class="comment">%log_text = vertcat(log_text,{outfile});</span>
0708     <span class="keyword">end</span>
0709     
0710     <span class="comment">% Delete the old file if it exists</span>
0711     <span class="keyword">if</span> exist(outfile, <span class="string">'file'</span>) == 2
0712         log_text = vertcat(log_text,{<span class="string">'Warning: The file'</span>;<span class="keyword">...</span>
0713             [<span class="string">'   '</span> outfile];<span class="keyword">...</span>
0714             <span class="string">'already exists. Overwriting file...'</span>});
0715         delete(outfile)
0716     <span class="keyword">end</span>
0717     
0718     <span class="comment">% Save DAV data to an Excel File</span>
0719     hwait = waitbar(0,<span class="string">'Exporting Excel File...'</span>);
0720     vmin = num2str(guiparams.depth_range_min);
0721     vmax = num2str(guiparams.depth_range_max);
0722     pvheaders = {<span class="keyword">...</span>
0723         <span class="string">'UTM_East'</span> <span class="string">'UTM_North'</span> <span class="string">'Dist_m'</span> <span class="string">'Bed_Elev_m'</span><span class="keyword">...</span>
0724         [<span class="string">'EastDAV_cm/s, dpth rng '</span> vmin <span class="string">' to '</span> vmax <span class="string">' m'</span>]<span class="keyword">...</span>
0725         [<span class="string">'NorthDAV_cm/s, dpth rng '</span> vmin <span class="string">' to '</span> vmax <span class="string">' m'</span>]<span class="keyword">...</span>
0726         <span class="string">'Vel_mag_cm/s'</span> <span class="string">'Vel_dir_deg'</span>};
0727     
0728 
0729     <span class="comment">% Initialize Variables</span>
0730     pvdata = []; Dist = [];
0731     X = []; Y = []; E = [];
0732     Ve = []; Vn =[]; Vm = []; Vd = [];
0733     
0734     <span class="comment">% Concatenate data from all MAT files into arrays</span>
0735     <span class="keyword">for</span> i = 1:length(guiparams.mat_file)
0736         <span class="comment">% Load current MAT-file</span>
0737         load(fullfile(guiparams.mat_path, guiparams.mat_file{i}))
0738         
0739         <span class="comment">% Location and Bathy</span>
0740         X = [X V.mcsX(1,:)];
0741         Y = [Y V.mcsY(1,:)];
0742         Dist = [Dist sort(V.mcsDist(1,:),<span class="string">'descend'</span>)];
0743         E = [E V.mcsBedElev];
0744         
0745         <span class="comment">% Build layer-averaged velocities</span>
0746         indx = find(V.mcsDepth(:,1) &lt; str2num(vmin) | V.mcsDepth(:,1) &gt; str2num(vmax));
0747         V.mcsX(indx,:) = nan;
0748         V.mcsY(indx,:) = nan;
0749         V.mcsEast(indx,:) = nan;
0750         V.mcsNorth(indx,:) = nan;
0751         Ve = [Ve <a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsEast)];
0752         Vn = [Vn <a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsNorth)];
0753         Vm = [Vm sqrt(<a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsEast).^2 + <a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsNorth).^2)];
0754         Vd = [Vd ari2geodeg(atan2(<a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsNorth),<a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsEast))*180/pi)];
0755         
0756         waitbar(i/(length(guiparams.mat_file)+1),hwait)
0757     <span class="keyword">end</span>
0758     
0759     <span class="comment">% Put output into 1 matrix</span>
0760     pvdata = [<span class="keyword">...</span>
0761         X; Y; Dist; E;<span class="keyword">...</span><span class="comment"> % Bathy and locations</span>
0762         Ve; Vn; Vm; Vd<span class="keyword">...</span><span class="comment"> % Velocity</span>
0763         ];
0764     pvdata(isnan(pvdata)) = -9999;
0765     
0766     <span class="comment">% Create table and write to Excel</span>
0767     pvout = num2cell(pvdata');
0768     pvout = vertcat(pvheaders,pvout);
0769     xlswrite(outfile,pvout,<span class="string">'Planview'</span>);
0770     
0771     <span class="comment">% Close out waitbar</span>
0772     waitbar(1,hwait)
0773     delete(hwait)
0774     
0775     <span class="comment">% Push messages to Log Window:</span>
0776     <span class="comment">% ----------------------------</span>
0777     statusLogging(handles.LogWindow, log_text)
0778 <span class="keyword">else</span>
0779     
0780     <span class="comment">% Force VMT to reprocess before outputing Excel</span>
0781     <a href="#_sub56" class="code" title="subfunction planviewPlotCallback(hObject, eventdata, handles)">planviewPlotCallback</a>(hObject, eventdata, handles)
0782     <a href="#_sub57" class="code" title="subfunction crosssectionPlotCallback(hObject, eventdata, handles)">crosssectionPlotCallback</a>(hObject, eventdata, handles)
0783     <span class="comment">% Refresh the Application Data:</span>
0784     guiparams   = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0785     z           = guiparams.z;
0786     A           = guiparams.A;
0787     V           = guiparams.V;
0788     Map         = guiparams.Map;
0789     wse         = guiparams.wse;
0790     PVdata      = guiparams.iric_anv_planview_data;
0791     
0792     
0793     log_text = {<span class="string">'Writing data to Excel file...'</span>};
0794     [excel_file,excel_path] = uiputfile(<span class="string">'*.xlsx'</span>,<span class="string">'Save *.xlsx file'</span>,<span class="keyword">...</span>
0795         fullfile(excel_path,excel_file));
0796     
0797     <span class="keyword">if</span> ischar(excel_path) <span class="comment">% The user did not hit &quot;Cancel&quot;</span>
0798         outfile = fullfile(excel_path,excel_file);
0799         <span class="comment">%log_text = vertcat(log_text,{outfile});</span>
0800         
0801         <span class="comment">% Delete the old file if it exists</span>
0802         <span class="keyword">if</span> exist(outfile, <span class="string">'file'</span>) == 2
0803             log_text = vertcat(log_text,{<span class="string">'Warning: The file'</span>;<span class="keyword">...</span>
0804                 [<span class="string">'   '</span> outfile];<span class="keyword">...</span>
0805                 <span class="string">'already exists. Overwriting file...'</span>});
0806             delete(outfile)
0807         <span class="keyword">end</span>
0808         
0809         <span class="comment">% Push messages to Log Window:</span>
0810         <span class="comment">% ----------------------------</span>
0811         statusLogging(handles.LogWindow, log_text)
0812         
0813         <span class="comment">% Save MCS Summary to an Excel File</span>
0814         hwait = waitbar(0,<span class="string">'Exporting Excel File...'</span>);
0815         xlswrite(outfile,{<span class="string">'Files:'</span>},<span class="string">'VMTSummary'</span>,<span class="string">'H4'</span>); waitbar(1/5,hwait)
0816         sout = guiparams.data_files';
0817         xlswrite(outfile,sout,<span class="string">'VMTSummary'</span>,<span class="string">'I4'</span>); waitbar(2/5,hwait)
0818         sout = {<span class="keyword">...</span>
0819             <span class="string">'VMT: Summary of Mean Cross Section'</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>;<span class="keyword">...</span>
0820             <span class="string">'VMT '</span> guiparams.vmt_version <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>;<span class="keyword">...</span>
0821             <span class="string">'Date Processed: '</span> datestr(now) <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>;<span class="keyword">...</span>
0822             <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>;<span class="keyword">...</span>
0823             <span class="string">'Mean Cross Section (MCS) Properties'</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>;<span class="keyword">...</span>
0824             <span class="string">'Horz. Grid Node Spacing (m):'</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> guiparams.horizontal_grid_node_spacing;<span class="keyword">...</span>
0825             <span class="string">'Vert. Grid Node Spacing (m):'</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> single(guiparams.A(1).Sup.binSize_cm)/100;<span class="keyword">...</span>
0826             <span class="string">'Endpoints:'</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">'UTM_East'</span>    <span class="string">'UTM_North'</span>;<span class="keyword">...</span>
0827             <span class="string">'Left Bank'</span>    <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>    V.xLeftBank V.yLeftBank;<span class="keyword">...</span>
0828             <span class="string">'Right Bank'</span>    <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>    V.xRightBank V.yRightBank;<span class="keyword">...</span>
0829             <span class="string">'Total Length in meters'</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> V.dl;<span class="keyword">...</span>
0830             <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>;<span class="keyword">...</span>
0831             <span class="string">'Mean Flow Direction (deg)'</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> V.mfd;<span class="keyword">...</span>
0832             <span class="string">'in geographic coordinates'</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>;<span class="keyword">...</span>
0833             <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span>;<span class="keyword">...</span>
0834             <span class="string">'Slope'</span>    <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> V.m;<span class="keyword">...</span>
0835             <span class="string">'Intercept'</span>    <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> V.b;<span class="keyword">...</span>
0836             <span class="string">'Theta (deg)'</span>    <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> <span class="string">''</span> V.theta};
0837         xlswrite(outfile,sout,<span class="string">'VMTSummary'</span>,<span class="string">'A1'</span>); waitbar(3/5,hwait)
0838         
0839         <span class="comment">% Save DAV data to an Excel File</span>
0840         vmin = num2str(guiparams.depth_range_min);
0841         vmax = num2str(guiparams.depth_range_max);
0842         pvheaders = {<span class="keyword">...</span>
0843             <span class="string">'UTM_East_WGS84'</span> <span class="string">'UTM_North_WGS84'</span> <span class="string">'Dist_m'</span> <span class="string">'Bed_Elev_m'</span><span class="keyword">...</span>
0844             [<span class="string">'EastDAV_cms_dpthrng_'</span> vmin <span class="string">'_to_'</span> vmax <span class="string">'m'</span>]<span class="keyword">...</span>
0845             [<span class="string">'NorthDAV_cms_dpthrng_'</span> vmin <span class="string">'_to_'</span> vmax <span class="string">'m'</span>]<span class="keyword">...</span>
0846             <span class="string">'Vel_mag_cms'</span> <span class="string">'Vel_dir_deg'</span>};
0847         
0848         <span class="comment">% Create block style matrix of all processed data</span>
0849         pvdata = [];
0850         
0851         <span class="comment">% Sort the Distances such that when plotting in 2D (Dist. vs. Depth),</span>
0852         <span class="comment">% you are looking upstream into the transect</span>
0853         Dist = sort(V.mcsDist,2,<span class="string">'descend'</span>);
0854         
0855         <span class="comment">% Build bathy data matrix</span>
0856         pvdata = [V.mcsX(1,:); V.mcsY(1,:); Dist(1,:); V.mcsBedElev];
0857         
0858         <span class="comment">% Build layer-averaged velocities</span>
0859         indx = find(V.mcsDepth(:,1) &lt; str2num(vmin) | V.mcsDepth(:,1) &gt; str2num(vmax));
0860         V.mcsX(indx,:) = nan;
0861         V.mcsY(indx,:) = nan;
0862         V.mcsEast(indx,:) = nan;
0863         V.mcsNorth(indx,:) = nan;
0864         pvdata = [<span class="keyword">...</span>
0865             pvdata;<span class="keyword">...</span>
0866             <a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsEast);<span class="keyword">...</span>
0867             <a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsNorth);<span class="keyword">...</span>
0868             sqrt(<a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsEast).^2 + <a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsNorth).^2);<span class="keyword">...</span>
0869             ari2geodeg(atan2(<a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsNorth), <a href="VMT_LayerAveMean.html" class="code" title="function lam = VMT_LayerAveMean(x,y)">VMT_LayerAveMean</a>(V.mcsDepth,V.mcsEast))*180/pi)];
0870         pvdata(isnan(pvdata)) = -9999;
0871         pvout = num2cell(pvdata');
0872         pvout = vertcat(pvheaders,pvout);
0873         xlswrite(outfile,pvout,<span class="string">'Planview'</span>);
0874         waitbar(4/5,hwait)
0875         
0876         <span class="comment">% Save MCS data to an Excel File</span>
0877         mcsheaders = {<span class="keyword">...</span>
0878             <span class="string">'UTM_East'</span> <span class="keyword">...</span>
0879             <span class="string">'UTM_North'</span><span class="keyword">...</span>
0880             <span class="string">'Distance from Left Bank, in meters'</span><span class="keyword">...</span>
0881             <span class="string">'Elevation, in meters'</span><span class="keyword">...</span>
0882             <span class="keyword">...</span><span class="comment">'Bed Elevation, in meters'...</span>
0883             <span class="string">'East Velocity, in cm/s'</span><span class="keyword">...</span>
0884             <span class="string">'North Velocity, in cm/s'</span><span class="keyword">...</span>
0885             <span class="string">'Vertical Velocity, in cm/s'</span><span class="keyword">...</span>
0886             <span class="string">'Velocity Magnitude, in cm/s'</span><span class="keyword">...</span>
0887             <span class="string">'Velocity Direction, in degrees (geographic coordinates)'</span><span class="keyword">...</span>
0888             <span class="string">'Streamwise Velocity, in cm/s'</span><span class="keyword">...</span>
0889             <span class="string">'Transverse Velocity, in cm/s'</span><span class="keyword">...</span>
0890             <span class="string">'Primary Velocity (zsd), in cm/s'</span><span class="keyword">...</span>
0891             <span class="string">'Secondary Velocity (zsd), in cm/s'</span><span class="keyword">...</span>
0892             <span class="string">'Primary Velocity (roz), in cm/s'</span><span class="keyword">...</span>
0893             <span class="string">'Secondary Velocity (roz), in cm/s'</span>};
0894         
0895         mcsdata = [<span class="keyword">...</span>
0896             V.mcsX(:)<span class="keyword">...</span>
0897             V.mcsY(:)<span class="keyword">...</span>
0898             V.mcsDist(:)<span class="keyword">...</span>
0899             (wse - V.mcsDepth(:))<span class="keyword">...</span>
0900             <span class="keyword">...</span><span class="comment">repmat((wse - V.mcsBed(:)),size(V.mcsX,1),1)...</span>
0901             V.mcsEast(:)<span class="keyword">...</span>
0902             V.mcsNorth(:)<span class="keyword">...</span>
0903             V.mcsVert(:)<span class="keyword">...</span>
0904             V.mcsMag(:)<span class="keyword">...</span>
0905             V.mcsDir(:)<span class="keyword">...</span>
0906             V.u(:)<span class="keyword">...</span>
0907             V.v(:)<span class="keyword">...</span>
0908             V.vp(:)<span class="keyword">...</span>
0909             V.vs(:)<span class="keyword">...</span>
0910             V.Roz.up(:)<span class="keyword">...</span>
0911             V.Roz.us(:)];
0912         mcsdata(isnan(mcsdata)) = -9999;
0913         
0914         mcsout = vertcat(mcsheaders,num2cell(mcsdata));
0915         xlswrite(outfile,mcsout,<span class="string">'MeanCrossSection'</span>);
0916         waitbar(1,hwait)
0917         delete(hwait)
0918         
0919     <span class="keyword">else</span>
0920         <span class="comment">% Return default excel_path and excel_file</span>
0921         excel_path = guiprefs.excel_path;
0922         excel_file = guiprefs.excel_file;
0923         outfile = fullfile(excel_path,excel_file);
0924         log_text = {<span class="string">'User aborted Excel export...'</span>};
0925     <span class="keyword">end</span>
0926     
0927     
0928     
0929 <span class="keyword">end</span>
0930 
0931 <span class="comment">% Push messages to Log Window:</span>
0932 <span class="comment">% ----------------------------</span>
0933 statusLogging(handles.LogWindow, log_text)
0934 
0935 <span class="comment">% Store the persistent preferences:</span>
0936 <span class="comment">% ---------------------------------</span>
0937 guiprefs.excel_file = excel_file;
0938 guiprefs.excel_path = excel_path;
0939 setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
0940 <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'excel'</span>)
0941 
0942 <span class="comment">% [EOF] menuSaveExcel_Callback</span>
0943 
0944 <span class="comment">% --------------------------------------------------------------------</span>
0945 <a name="_sub26" href="#_subfunctions" class="code">function menuParameters_Callback(hObject, eventdata, handles)</a>
0946 <span class="comment">% Empty</span>
0947 
0948 <span class="comment">% --------------------------------------------------------------------</span>
0949 <a name="_sub27" href="#_subfunctions" class="code">function menuProcessingParameters_Callback(hObject, eventdata, handles)</a>
0950 <span class="comment">% Empty</span>
0951 
0952 <span class="comment">% --------------------------------------------------------------------</span>
0953 <a name="_sub28" href="#_subfunctions" class="code">function menuUnitDischargeCorrection_Callback(hObject, eventdata, handles)</a>
0954 <span class="comment">% Turn ON or OFF Unit Discharge Correction</span>
0955 
0956 <span class="comment">% Get the Application Data:</span>
0957 <span class="comment">% -------------------------</span>
0958 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0959 
0960 <span class="comment">% Update the GUI &amp; Application Data:</span>
0961 <span class="comment">% ----------------------------------</span>
0962 status = get(handles.menuUnitDischargeCorrection,<span class="string">'Checked'</span>);
0963 <span class="keyword">switch</span> status
0964     <span class="keyword">case</span> <span class="string">'on'</span> <span class="comment">% Turn it off</span>
0965         set(handles.menuUnitDischargeCorrection, <span class="string">'Checked'</span>,<span class="string">'off'</span>)
0966         guiparams.unit_discharge_correction = false;
0967     <span class="keyword">case</span> <span class="string">'off'</span> <span class="comment">% Turn it on</span>
0968         set(handles.menuUnitDischargeCorrection, <span class="string">'Checked'</span>,<span class="string">'on'</span>)
0969         guiparams.unit_discharge_correction = true;
0970 <span class="keyword">end</span>
0971 
0972 <span class="comment">% Re-store the Application data:</span>
0973 <span class="comment">% ------------------------------</span>
0974 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
0975 
0976 
0977 <span class="comment">%  [EOF] menuUnitDischargeCorrection_Callback</span>
0978 
0979 <span class="comment">% --------------------------------------------------------------------</span>
0980 <a name="_sub29" href="#_subfunctions" class="code">function menuPlottingParameters_Callback(hObject, eventdata, handles)</a>
0981 <span class="comment">% Empty</span>
0982 
0983 <span class="comment">% --------------------------------------------------------------------</span>
0984 <a name="_sub30" href="#_subfunctions" class="code">function menuUnits_Callback(hObject, eventdata, handles)</a>
0985 <span class="comment">% Empty</span>
0986 
0987 <span class="comment">% --------------------------------------------------------------------</span>
0988 <a name="_sub31" href="#_subfunctions" class="code">function menuMetric_Callback(hObject, eventdata, handles)</a>
0989 <span class="comment">% Set the Plotting Parameter Units to &quot;metric&quot;</span>
0990 
0991 <span class="comment">% Get the Application Data:</span>
0992 <span class="comment">% -------------------------</span>
0993 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
0994 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
0995 
0996 <span class="comment">% Update the Application Data:</span>
0997 <span class="comment">% ----------------------------</span>
0998 guiparams.english_units = false;
0999 guiprefs.units = <span class="string">'metric'</span>;
1000 
1001 <span class="comment">% Re-store the Application data:</span>
1002 <span class="comment">% ------------------------------</span>
1003 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1004 setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
1005 <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'units'</span>)
1006 
1007 <span class="comment">% Update the GUI:</span>
1008 <span class="comment">% ---------------</span>
1009 set(handles.menuMetric, <span class="string">'Checked'</span>,<span class="string">'on'</span>)
1010 set(handles.menuEnglish,<span class="string">'Checked'</span>,<span class="string">'off'</span>)
1011 
1012 <span class="comment">% [EOF] menuMetric_Callback</span>
1013 
1014 
1015 <span class="comment">% --------------------------------------------------------------------</span>
1016 <a name="_sub32" href="#_subfunctions" class="code">function menuEnglish_Callback(hObject, eventdata, handles)</a>
1017 <span class="comment">% Set the Plotting Parameter Units to &quot;english&quot;</span>
1018 
1019 <span class="comment">% Get the Application Data:</span>
1020 <span class="comment">% -------------------------</span>
1021 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1022 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
1023 
1024 <span class="comment">% Update the Application Data:</span>
1025 <span class="comment">% ----------------------------</span>
1026 guiparams.english_units = true;
1027 guiprefs.units = <span class="string">'english'</span>;
1028 
1029 <span class="comment">% Re-store the Application data:</span>
1030 <span class="comment">% ------------------------------</span>
1031 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1032 setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
1033 <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'units'</span>)
1034 
1035 <span class="comment">% Update the GUI:</span>
1036 <span class="comment">% ---------------</span>
1037 set(handles.menuMetric, <span class="string">'Checked'</span>,<span class="string">'off'</span>)
1038 set(handles.menuEnglish,<span class="string">'Checked'</span>,<span class="string">'on'</span>)
1039 
1040 <span class="comment">% [EOF] menuEnglish_Callback</span>
1041 
1042 
1043 <span class="comment">% --------------------------------------------------------------------</span>
1044 <a name="_sub33" href="#_subfunctions" class="code">function menuSetCrossSectionEndpoints_Callback(hObject, eventdata, handles)</a>
1045 <span class="comment">% Empty</span>
1046 
1047 <span class="comment">% --------------------------------------------------------------------</span>
1048 <a name="_sub34" href="#_subfunctions" class="code">function menuCrossSectionEndpointAutomatic_Callback(hObject, eventdata, handles)</a>
1049 <span class="comment">% Set cross-section endpoints automatically</span>
1050 
1051 <span class="comment">% Get the Application Data:</span>
1052 <span class="comment">% -------------------------</span>
1053 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1054 
1055 <span class="comment">% Update the Application Data:</span>
1056 <span class="comment">% ----------------------------</span>
1057 guiparams.set_cross_section_endpoints = false;
1058 
1059 <span class="comment">% Re-store the Application data:</span>
1060 <span class="comment">% ------------------------------</span>
1061 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1062 
1063 <span class="comment">% Update the GUI:</span>
1064 <span class="comment">% ---------------</span>
1065 set(handles.menuCrossSectionEndpointAutomatic, <span class="string">'Checked'</span>,<span class="string">'on'</span>)
1066 set(handles.menuCrossSectionEndpointManual,    <span class="string">'Checked'</span>,<span class="string">'off'</span>)
1067 
1068 <span class="comment">% [EOF] menuCrossSectionEndpointAutomatic_Callback</span>
1069 
1070 
1071 <span class="comment">% --------------------------------------------------------------------</span>
1072 <a name="_sub35" href="#_subfunctions" class="code">function menuCrossSectionEndpointManual_Callback(hObject, eventdata, handles)</a>
1073 <span class="comment">% Set cross-section endpoints manually</span>
1074 
1075 <span class="comment">% Get the Application Data:</span>
1076 <span class="comment">% -------------------------</span>
1077 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1078 
1079 <span class="comment">% Update the Application Data:</span>
1080 <span class="comment">% ----------------------------</span>
1081 guiparams.set_cross_section_endpoints = true;
1082 
1083 <span class="comment">% Re-store the Application data:</span>
1084 <span class="comment">% ------------------------------</span>
1085 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1086 
1087 <span class="comment">% Update the GUI:</span>
1088 <span class="comment">% ---------------</span>
1089 set(handles.menuCrossSectionEndpointAutomatic, <span class="string">'Checked'</span>,<span class="string">'off'</span>)
1090 set(handles.menuCrossSectionEndpointManual,    <span class="string">'Checked'</span>,<span class="string">'on'</span>)
1091 
1092 <span class="comment">% [EOF] menuCrossSectionEndpointManual_Callback</span>
1093 
1094 
1095 
1096 
1097 <span class="comment">% --------------------------------------------------------------------</span>
1098 <a name="_sub36" href="#_subfunctions" class="code">function menuPlotStyle_Callback(hObject, eventdata, handles)</a>
1099 <span class="comment">% Empty</span>
1100 
1101 <span class="comment">% --------------------------------------------------------------------</span>
1102 <a name="_sub37" href="#_subfunctions" class="code">function menuStylePrint_Callback(hObject, eventdata, handles)</a>
1103 
1104 <span class="comment">% Get the Application Data:</span>
1105 <span class="comment">% -------------------------</span>
1106 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1107 
1108 <span class="comment">% Update the Application Data:</span>
1109 <span class="comment">% ----------------------------</span>
1110 guiparams.print        = true;
1111 guiparams.presentation = false;
1112 
1113 <span class="comment">% Re-store the Application data:</span>
1114 <span class="comment">% ------------------------------</span>
1115 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1116 
1117 <span class="comment">% Update the GUI:</span>
1118 <span class="comment">% ---------------</span>
1119 set(handles.menuStylePrint,        <span class="string">'Checked'</span>,<span class="string">'on'</span>)
1120 set(handles.menuStylePresentation, <span class="string">'Checked'</span>,<span class="string">'off'</span>)
1121 set(handles.menuPrintFormat,       <span class="string">'Checked'</span>,<span class="string">'on'</span>)
1122 set(handles.menuPresentationFormat,<span class="string">'Checked'</span>,<span class="string">'off'</span>)
1123 
1124 <span class="comment">% Modify the existing figures</span>
1125 <span class="comment">% ---------------------------</span>
1126 <span class="comment">% Find what plots exist already</span>
1127 hf = findobj(<span class="string">'type'</span>,<span class="string">'figure'</span>);
1128 valid_names = {<span class="string">'Plan View Map'</span>; <span class="string">'Mean Cross Section Contour'</span>};
1129 
1130 <span class="comment">% Defaults for Print Stlye Figure</span>
1131 BkgdColor   = <span class="string">'white'</span>;
1132 AxColor     = <span class="string">'black'</span>;
1133 FigColor    = <span class="string">'white'</span>; <span class="comment">% [0.3 0.3 0.3]</span>
1134 FntSize     = 14;
1135 
1136 <span class="comment">% Loop through valid figures and adjust</span>
1137 <span class="comment">% -------------------------------------</span>
1138 <span class="keyword">if</span> ~isempty(hf) &amp;&amp;  any(ishandle(hf))
1139     
1140     <span class="keyword">for</span> i = 1:length(valid_names)
1141         <span class="keyword">switch</span> valid_names{i}
1142             <span class="keyword">case</span> <span class="string">'Plan View Map'</span>
1143                 <span class="comment">% Focus the figure</span>
1144                 hff = findobj(<span class="string">'name'</span>,<span class="string">'Plan View Map'</span>);
1145                 <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
1146                     figure(hff)
1147                     
1148                     <span class="comment">% Make the changes to figure</span>
1149                     set(gcf,<span class="string">'Color'</span>,BkgdColor);
1150                     set(gca,<span class="string">'FontSize'</span>,FntSize)
1151                     set(get(gca,<span class="string">'Title'</span>),<span class="string">'FontSize'</span>,FntSize)
1152                     set(gca,<span class="string">'Color'</span>,FigColor)
1153                     set(gca,<span class="string">'XColor'</span>,AxColor)
1154                     set(gca,<span class="string">'YColor'</span>,AxColor)
1155                     set(gca,<span class="string">'ZColor'</span>,AxColor)
1156                     set(findobj(gcf,<span class="string">'tag'</span>,<span class="string">'Colorbar'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'XColor'</span>,AxColor,<span class="string">'YColor'</span>,AxColor);
1157                     set(get(gca,<span class="string">'Title'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1158                     set(get(gca,<span class="string">'xLabel'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1159                     set(get(gca,<span class="string">'yLabel'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1160                 <span class="keyword">end</span>
1161             <span class="keyword">case</span> <span class="string">'Mean Cross Section Contour'</span>
1162                 <span class="comment">% Focus the figure</span>
1163                 hff = findobj(<span class="string">'name'</span>,<span class="string">'Mean Cross Section Contour'</span>);
1164                 <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
1165                     figure(hff)
1166                     
1167                     <span class="comment">% Make the changes to figure</span>
1168                     set(gcf,<span class="string">'Color'</span>,BkgdColor);
1169                     set(gca,<span class="string">'FontSize'</span>,FntSize)
1170                     set(get(gca,<span class="string">'Title'</span>),<span class="string">'FontSize'</span>,FntSize)
1171                     set(gca,<span class="string">'Color'</span>,FigColor)
1172                     set(gca,<span class="string">'XColor'</span>,AxColor)
1173                     set(gca,<span class="string">'YColor'</span>,AxColor)
1174                     set(gca,<span class="string">'ZColor'</span>,AxColor)
1175                     set(findobj(gcf,<span class="string">'tag'</span>,<span class="string">'Colorbar'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'XColor'</span>,AxColor,<span class="string">'YColor'</span>,AxColor);
1176                     set(get(gca,<span class="string">'Title'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1177                     set(get(gca,<span class="string">'xLabel'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1178                     set(get(gca,<span class="string">'yLabel'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1179                     set(findobj(gca,<span class="string">'tag'</span>,<span class="string">'PlotBedElevation'</span>)   ,<span class="string">'color'</span>    ,AxColor)
1180                     set(findobj(gca,<span class="string">'tag'</span>,<span class="string">'ReferenceVectorText'</span>),<span class="string">'color'</span>    ,AxColor)
1181                 <span class="keyword">end</span>
1182             <span class="keyword">otherwise</span>
1183         <span class="keyword">end</span>
1184     <span class="keyword">end</span>
1185     
1186     
1187 <span class="keyword">end</span>
1188 
1189 
1190 <span class="comment">%[EOF] menuStylePrint_Callback</span>
1191 
1192 
1193 <span class="comment">% --------------------------------------------------------------------</span>
1194 <a name="_sub38" href="#_subfunctions" class="code">function menuStylePresentation_Callback(hObject, eventdata, handles)</a>
1195 <span class="comment">% Get the Application Data:</span>
1196 <span class="comment">% -------------------------</span>
1197 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1198 
1199 <span class="comment">% Update the Application Data:</span>
1200 <span class="comment">% ----------------------------</span>
1201 guiparams.print        = false;
1202 guiparams.presentation = true;
1203 
1204 <span class="comment">% Re-store the Application data:</span>
1205 <span class="comment">% ------------------------------</span>
1206 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1207 
1208 <span class="comment">% Update the GUI:</span>
1209 <span class="comment">% ---------------</span>
1210 set(handles.menuStylePrint,        <span class="string">'Checked'</span>,<span class="string">'off'</span>)
1211 set(handles.menuStylePresentation, <span class="string">'Checked'</span>,<span class="string">'on'</span>)
1212 set(handles.menuPrintFormat,       <span class="string">'Checked'</span>,<span class="string">'off'</span>)
1213 set(handles.menuPresentationFormat,<span class="string">'Checked'</span>,<span class="string">'on'</span>)
1214 
1215 <span class="comment">% Modify the existing figures</span>
1216 <span class="comment">% ---------------------------</span>
1217 <span class="comment">% Find what plots exist already</span>
1218 hf = findobj(<span class="string">'type'</span>,<span class="string">'figure'</span>);
1219 valid_names = {<span class="string">'Plan View Map'</span>; <span class="string">'Mean Cross Section Contour'</span>};
1220 
1221 <span class="comment">% Defaults for Presentation Stlye Figure</span>
1222 <span class="comment">% --------------------------------------</span>
1223 BkgdColor   = <span class="string">'black'</span>;
1224 AxColor     = <span class="string">'white'</span>;
1225 FigColor    = <span class="string">'black'</span>; <span class="comment">% [0.3 0.3 0.3]</span>
1226 FntSize     = 14;
1227 
1228 <span class="comment">% Loop through valid figures and adjust</span>
1229 <span class="comment">% -------------------------------------</span>
1230 <span class="keyword">if</span> ~isempty(hf) &amp;&amp;  any(ishandle(hf))
1231     
1232     <span class="keyword">for</span> i = 1:length(valid_names)
1233         <span class="keyword">switch</span> valid_names{i}
1234             <span class="keyword">case</span> <span class="string">'Plan View Map'</span>
1235                 <span class="comment">% Focus the figure</span>
1236                 hff = findobj(<span class="string">'name'</span>,<span class="string">'Plan View Map'</span>);
1237                 <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
1238                     figure(hff)
1239                     
1240                     <span class="comment">% Make the changes to figure</span>
1241                     set(gcf,<span class="string">'Color'</span>,BkgdColor);
1242                     set(gca,<span class="string">'FontSize'</span>,FntSize)
1243                     set(get(gca,<span class="string">'Title'</span>),<span class="string">'FontSize'</span>,FntSize)
1244                     set(gca,<span class="string">'Color'</span>,FigColor)
1245                     set(gca,<span class="string">'XColor'</span>,AxColor)
1246                     set(gca,<span class="string">'YColor'</span>,AxColor)
1247                     set(gca,<span class="string">'ZColor'</span>,AxColor)
1248                     set(findobj(gcf,<span class="string">'tag'</span>,<span class="string">'Colorbar'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'XColor'</span>,AxColor,<span class="string">'YColor'</span>,AxColor);
1249                     set(get(gca,<span class="string">'Title'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1250                     set(get(gca,<span class="string">'xLabel'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1251                     set(get(gca,<span class="string">'yLabel'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1252                     
1253                     <span class="comment">% Add a text object at the bottom of the figure with</span>
1254                     <span class="comment">% the file(s) and path for the data</span>
1255                     ismultiplot = numel(guiparams.mat_file)&gt;1;
1256                     <span class="keyword">if</span> ~ismultiplot
1257                         filestr = guiparams.savefile;
1258                         wd = length(filestr);
1259                         hd = 1;
1260                     <span class="keyword">else</span>
1261                         <span class="comment">% Construct a filename</span>
1262                         filestr   = [{guiparams.mat_path};guiparams.mat_file'];
1263                         wd        = max(cellfun(@length,filestr));
1264                         hd        = numel(filestr);
1265                             
1266                     <span class="keyword">end</span>
1267                     
1268                     fileinfotxt = uicontrol(<span class="string">'style'</span>,<span class="string">'text'</span>,<span class="string">'units'</span>,<span class="string">'characters'</span>);
1269                     set(fileinfotxt,<span class="keyword">...</span>
1270                         <span class="string">'string'</span>,filestr)
1271                     set(fileinfotxt,<span class="keyword">...</span>
1272                         <span class="string">'position'</span>,[0,0,wd,hd],<span class="keyword">...</span>
1273                         <span class="string">'Fontsize'</span>,FntSize/2,<span class="keyword">...</span>
1274                         <span class="string">'ForegroundColor'</span>,AxColor,<span class="keyword">...</span>
1275                         <span class="string">'BackgroundColor'</span>,BkgdColor,<span class="keyword">...</span>
1276                         <span class="string">'HorizontalAlignment'</span>,<span class="string">'Left'</span>)
1277                     
1278                 <span class="keyword">end</span>
1279             <span class="keyword">case</span> <span class="string">'Mean Cross Section Contour'</span>
1280                 <span class="comment">% Focus the figure</span>
1281                 hff = findobj(<span class="string">'name'</span>,<span class="string">'Mean Cross Section Contour'</span>);
1282                 <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
1283                     figure(hff)
1284                     
1285                     <span class="comment">% Make the changes to figure</span>
1286                     set(gcf,<span class="string">'Color'</span>,BkgdColor);
1287                     set(gca,<span class="string">'FontSize'</span>,FntSize)
1288                     set(get(gca,<span class="string">'Title'</span>),<span class="string">'FontSize'</span>,FntSize)
1289                     set(gca,<span class="string">'Color'</span>,[0.3 0.3 0.3]) <span class="comment">%FigColor)</span>
1290                     set(gca,<span class="string">'XColor'</span>,AxColor)
1291                     set(gca,<span class="string">'YColor'</span>,AxColor)
1292                     set(gca,<span class="string">'ZColor'</span>,AxColor)
1293                     set(findobj(gcf,<span class="string">'tag'</span>,<span class="string">'Colorbar'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'XColor'</span>,AxColor,<span class="string">'YColor'</span>,AxColor);
1294                     set(get(gca,<span class="string">'Title'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1295                     set(get(gca,<span class="string">'xLabel'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1296                     set(get(gca,<span class="string">'yLabel'</span>),<span class="string">'FontSize'</span>,FntSize,<span class="string">'Color'</span>,AxColor)
1297                     set(findobj(gca,<span class="string">'tag'</span>,<span class="string">'PlotBedElevation'</span>)   ,<span class="string">'color'</span>    ,AxColor)
1298                     set(findobj(gca,<span class="string">'tag'</span>,<span class="string">'ReferenceVectorText'</span>),<span class="string">'color'</span>    ,AxColor)
1299                     
1300                     <span class="comment">% Add a text object at the bottom of the figure with</span>
1301                     <span class="comment">% the file(s) and path for the data</span>
1302                     ismultiplot = numel(guiparams.mat_file)&gt;1;
1303                     <span class="keyword">if</span> ~ismultiplot
1304                         filestr = guiparams.savefile;
1305                         wd = length(filestr);
1306                         hd = 1;
1307                     <span class="keyword">else</span>
1308                         <span class="comment">% Construct a filename</span>
1309                         filestr   = [{guiparams.mat_path};guiparams.mat_file'];
1310                         wd        = max(cellfun(@length,filestr));
1311                         hd        = numel(filestr);
1312                             
1313                     <span class="keyword">end</span>
1314                     
1315                     fileinfotxt = uicontrol(<span class="string">'style'</span>,<span class="string">'text'</span>,<span class="string">'units'</span>,<span class="string">'characters'</span>);
1316                     set(fileinfotxt,<span class="keyword">...</span>
1317                         <span class="string">'string'</span>,filestr)
1318                     set(fileinfotxt,<span class="keyword">...</span>
1319                         <span class="string">'position'</span>,[0,0,wd,hd],<span class="keyword">...</span>
1320                         <span class="string">'Fontsize'</span>,FntSize/2,<span class="keyword">...</span>
1321                         <span class="string">'ForegroundColor'</span>,AxColor,<span class="keyword">...</span>
1322                         <span class="string">'BackgroundColor'</span>,BkgdColor,<span class="keyword">...</span>
1323                         <span class="string">'HorizontalAlignment'</span>,<span class="string">'Left'</span>)
1324                 <span class="keyword">end</span>
1325             <span class="keyword">otherwise</span>
1326         <span class="keyword">end</span>
1327     <span class="keyword">end</span>
1328     
1329     
1330 <span class="keyword">end</span>
1331 
1332 <span class="comment">% [EOF] menuStylePresentation_Callback</span>
1333 
1334 <span class="comment">% --------------------------------------------------------------------</span>
1335 <a name="_sub39" href="#_subfunctions" class="code">function menuKMZVerticalOffset_Callback(hObject, eventdata, handles)</a>
1336 
1337 <span class="comment">% Get the Application data:</span>
1338 <span class="comment">% -------------------------</span>
1339 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1340 
1341 <span class="comment">% Initialize the answer:</span>
1342 <span class="comment">% ----------------------</span>
1343 numstr = {num2str(guiparams.vertical_offset)};
1344 answer = NaN;
1345 <span class="keyword">while</span> isnan(answer)
1346     answer = inputdlg(<span class="string">'Vertical Offset (m)'</span>,<span class="string">'KMZ Export'</span>,1,numstr);
1347     
1348     <span class="keyword">if</span> isempty(answer) <span class="comment">% User hits &quot;Cancel&quot;</span>
1349         <span class="keyword">return</span>
1350     <span class="keyword">end</span>
1351     
1352     answer = str2double(answer); <span class="comment">% A non-numeric char will be NaN</span>
1353     <span class="comment">% A numeric char will be a double</span>
1354 <span class="keyword">end</span>
1355 
1356 <span class="comment">% Re-store the Application data:</span>
1357 <span class="comment">% ------------------------------</span>
1358 guiparams.vertical_offset = answer;
1359 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1360 
1361 <span class="comment">% [EOF] menuKMZExport_Callback</span>
1362 
1363 <span class="comment">% --------------------------------------------------------------------</span>
1364 <a name="_sub40" href="#_subfunctions" class="code">function menuBathymetryParameters_Callback(hObject, eventdata, handles)</a>
1365 <span class="comment">% Not implemented</span>
1366 
1367 <span class="comment">% --------------------------------------------------------------------</span>
1368 <a name="_sub41" href="#_subfunctions" class="code">function menuTools_Callback(hObject, eventdata, handles)</a>
1369 <span class="comment">% Empty</span>
1370 
1371 <span class="comment">% --------------------------------------------------------------------</span>
1372 <a name="_sub42" href="#_subfunctions" class="code">function menuASCII2GIS_Callback(hObject, eventdata, handles)</a>
1373 ASCII2GIS_GUI
1374 <span class="comment">% [EOF] menuASCII2GIS_Callback</span>
1375 
1376 <span class="comment">% --------------------------------------------------------------------</span>
1377 <a name="_sub43" href="#_subfunctions" class="code">function menuASCII2KML_Callback(hObject, eventdata, handles)</a>
1378 
1379 <span class="comment">% Get the Application preferences:</span>
1380 <span class="comment">% --------------------------------</span>
1381 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
1382 
1383 inpath = guiprefs.kmz_path;
1384 <span class="keyword">if</span> iscell(guiprefs.kmz_file)
1385     infile = guiprefs.kmz_file{1};
1386 <span class="keyword">else</span>
1387     infile = guiprefs.kmz_file;
1388 <span class="keyword">end</span>
1389 [log_text,outpath,outfile] = ASCII2KML(inpath,infile);
1390 
1391 guiprefs.kmz_path = outpath;
1392 guiprefs.kmz_file = outfile;
1393 
1394 <span class="comment">% Update persistent preferences</span>
1395 <span class="comment">% -----------------------------</span>
1396 setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
1397 
1398 <span class="comment">% [EOF] menuASCII2KML_Callback</span>
1399 
1400 <span class="comment">% --------------------------------------------------------------------</span>
1401 <a name="_sub44" href="#_subfunctions" class="code">function menuOpenBatchMode_Callback(hObject, eventdata, handles)</a>
1402 <span class="comment">% Get the Application preferences:</span>
1403 <span class="comment">% --------------------------------</span>
1404 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
1405 
1406 VMT_BatchMode;
1407 <span class="comment">% [EOF] menuOpenBatchMode_Callback</span>
1408 
1409 <span class="comment">% --------------------------------------------------------------------</span>
1410 <a name="_sub45" href="#_subfunctions" class="code">function menuHelp_Callback(hObject, eventdata, handles)</a>
1411 <span class="comment">% Empty</span>
1412 
1413 <span class="comment">% --------------------------------------------------------------------</span>
1414 <a name="_sub46" href="#_subfunctions" class="code">function menuUsersGuide_Callback(hObject, eventdata, handles)</a>
1415 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1416 <span class="keyword">try</span> <span class="comment">% to open the User Guide PDF</span>
1417     open([pwd filesep <span class="string">'doc'</span> filesep <span class="string">'VMT User Guide '</span> guiparams.vmt_version <span class="string">'.pdf'</span>]);
1418     
1419 <span class="keyword">catch</span> err <span class="comment">%#ok&lt;NASGU&gt;</span>
1420     
1421     <span class="keyword">if</span> isdeployed
1422         errLogFileName = fullfile(pwd,<span class="keyword">...</span>
1423             [<span class="string">'errorLog'</span> datestr(now,<span class="string">'yyyymmddHHMMSS'</span>) <span class="string">'.txt'</span>]);
1424         msgbox({[<span class="string">'An unexpected error occurred. Error code: '</span> err.identifier];<span class="keyword">...</span>
1425             [<span class="string">'Error details are being written to the following file: '</span>];<span class="keyword">...</span>
1426             errLogFileName},<span class="keyword">...</span>
1427             <span class="string">'VMT Status: Unexpected Error'</span>,<span class="keyword">...</span>
1428             <span class="string">'error'</span>);
1429         fid = fopen(errLogFileName,<span class="string">'W'</span>);
1430         fwrite(fid,err.getReport(<span class="string">'extended'</span>,<span class="string">'hyperlinks'</span>,<span class="string">'off'</span>));
1431         fclose(fid);
1432         rethrow(err)
1433     <span class="keyword">else</span>
1434         msgbox([<span class="string">'An unexpected error occurred. Error code: '</span> err.identifier],<span class="keyword">...</span>
1435             <span class="string">'VMT Status: Unexpected Error'</span>,<span class="keyword">...</span>
1436             <span class="string">'error'</span>);
1437         rethrow(err);
1438     <span class="keyword">end</span>
1439 <span class="keyword">end</span>
1440 <span class="comment">% [EOF] menuASCII2KML_Callback</span>
1441 
1442 <span class="comment">% --------------------------------------------------------------------</span>
1443 <a name="_sub47" href="#_subfunctions" class="code">function menuFunctionLibrary_Callback(hObject, eventdata, handles)</a>
1444 <span class="comment">% Get the Application data:</span>
1445 <span class="comment">% -------------------------</span>
1446 <span class="comment">% guiparams = getappdata(handles.figure1,'guiparams'); %#ok&lt;NASGU&gt;</span>
1447 
1448 <span class="keyword">try</span>
1449     <span class="comment">% Construct a URL to a local file which can be interpreted by any</span>
1450     <span class="comment">% web-browser</span>
1451     rootpath = strrep(pwd,filesep,<span class="string">'/'</span>);
1452     webaddress = [<span class="string">'file:///'</span> rootpath <span class="string">'/doc/index.html'</span>];
1453     system([<span class="string">'start '</span> webaddress]);
1454 <span class="comment">%     [stat,h,url] = web(webaddress) % Produced with m2html (FEX)</span>
1455 <span class="keyword">catch</span> err 
1456     <span class="keyword">if</span> isdeployed
1457         errLogFileName = fullfile(pwd,<span class="keyword">...</span>
1458             [<span class="string">'errorLog'</span> datestr(now,<span class="string">'yyyymmddHHMMSS'</span>) <span class="string">'.txt'</span>]);
1459         msgbox({[<span class="string">'An unexpected error occurred. Error code: '</span> err.identifier];<span class="keyword">...</span>
1460             [<span class="string">'Error details are being written to the following file: '</span>];<span class="keyword">...</span>
1461             errLogFileName},<span class="keyword">...</span>
1462             <span class="string">'VMT Status: Unexpected Error'</span>,<span class="keyword">...</span>
1463             <span class="string">'error'</span>);
1464         fid = fopen(errLogFileName,<span class="string">'W'</span>);
1465         fwrite(fid,err.getReport(<span class="string">'extended'</span>,<span class="string">'hyperlinks'</span>,<span class="string">'off'</span>));
1466         fclose(fid);
1467         rethrow(err)
1468     <span class="keyword">else</span>
1469         msgbox([<span class="string">'An unexpected error occurred. Error code: '</span> err.identifier],<span class="keyword">...</span>
1470             <span class="string">'VMT Status: Unexpected Error'</span>,<span class="keyword">...</span>
1471             <span class="string">'error'</span>);
1472         rethrow(err);
1473     <span class="keyword">end</span>
1474 <span class="keyword">end</span>
1475 
1476 <span class="comment">% [EOF] menuFunctionLibrary_Callback</span>
1477 
1478 <span class="comment">% --------------------------------------------------------------------</span>
1479 <a name="_sub48" href="#_subfunctions" class="code">function menuCheckForUpdates_Callback(hObject, eventdata, handles)</a>
1480 
1481 <span class="comment">% Get the Application data:</span>
1482 <span class="comment">% -------------------------</span>
1483 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1484 
1485 <span class="comment">% Check version tag against the web, and display a message</span>
1486 <span class="keyword">try</span>
1487     current_vmt_version = urlread(<span class="string">'http://hydroacoustics.usgs.gov/movingboat/VMT/VMT_version.txt'</span>);
1488     <span class="comment">%     current_vmt_version = urlread('http://hydroacoustics.usgs.gov/movingboat/VMT/VMT_version.txt');</span>
1489 <span class="keyword">catch</span> err <span class="comment">%#ok&lt;NASGU&gt;</span>
1490     <span class="keyword">if</span> isdeployed
1491         errLogFileName = fullfile(pwd,<span class="keyword">...</span>
1492             [<span class="string">'errorLog'</span> datestr(now,<span class="string">'yyyymmddHHMMSS'</span>) <span class="string">'.txt'</span>]);
1493         msgbox({[<span class="string">'An unexpected error occurred. Error code: '</span> err.identifier];<span class="keyword">...</span>
1494             [<span class="string">'Error details are being written to the following file: '</span>];<span class="keyword">...</span>
1495             errLogFileName},<span class="keyword">...</span>
1496             <span class="string">'VMT Status: Unexpected Error'</span>,<span class="keyword">...</span>
1497             <span class="string">'error'</span>);
1498         fid = fopen(errLogFileName,<span class="string">'W'</span>);
1499         fwrite(fid,err.getReport(<span class="string">'extended'</span>,<span class="string">'hyperlinks'</span>,<span class="string">'off'</span>));
1500         fclose(fid);
1501         rethrow(err)
1502     <span class="keyword">else</span>
1503         msgbox([<span class="string">'An unexpected error occurred. Error code: '</span> err.identifier],<span class="keyword">...</span>
1504             <span class="string">'VMT Status: Unexpected Error'</span>,<span class="keyword">...</span>
1505             <span class="string">'error'</span>);
1506         rethrow(err);
1507     <span class="keyword">end</span>
1508 <span class="keyword">end</span>
1509 
1510 <span class="keyword">if</span> strcmpi(guiparams.vmt_version,current_vmt_version)
1511     h = msgbox(<span class="string">'VMT is currently up to date, no updates available.'</span>,<span class="string">'Check for updates'</span>); <span class="comment">%#ok&lt;NASGU&gt;</span>
1512 <span class="keyword">else</span>
1513     h = msgbox(<span class="string">'VMT is out of date. Please visit the VMT homepage.'</span>,<span class="string">'Check for updates'</span>); <span class="comment">%#ok&lt;NASGU&gt;</span>
1514 <span class="keyword">end</span>
1515 <span class="comment">% [EOF] menuCheckForUpdates_Callback</span>
1516 
1517 <span class="comment">% --------------------------------------------------------------------</span>
1518 <a name="_sub49" href="#_subfunctions" class="code">function menuAbout_Callback(hObject, eventdata, handles)</a>
1519 
1520 <span class="comment">% Get the Application data:</span>
1521 <span class="comment">% -------------------------</span>
1522 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1523 messagestr = <span class="keyword">...</span>
1524     {<span class="string">'The Velocity Mapping Toolbox'</span>;<span class="keyword">...</span>
1525     [<span class="string">'   Version: '</span> guiparams.vmt_version];<span class="keyword">...</span>
1526     <span class="string">''</span>;<span class="keyword">...</span>
1527     <span class="string">''</span>;<span class="keyword">...</span>
1528     <span class="string">'With collaborations from:'</span>;<span class="keyword">...</span>
1529     <span class="string">'   U.S. Geological Survey'</span>;<span class="keyword">...</span>
1530     <span class="string">'   University of Illinois'</span>;<span class="keyword">...</span>
1531     <span class="string">'   University of Hull'</span>;<span class="keyword">...</span>
1532     <span class="string">''</span>;<span class="keyword">...</span>
1533     <span class="string">''</span>;<span class="keyword">...</span>
1534     <span class="string">'Citation: '</span>;<span class="keyword">...</span>
1535     <span class="string">'   Parsons, D. R., Jackson, P. R., Czuba, J. A., Engel, F. L.,'</span>;<span class="keyword">...</span>
1536     <span class="string">'   Rhoads, B. L., Oberg, K. A., Best, J. L., Mueller, D. S.,'</span>;<span class="keyword">...</span>
1537     <span class="string">'   Johnson, K. K. and Riley, J. D. (2013), Velocity Mapping'</span>;<span class="keyword">...</span>
1538     <span class="string">'   Toolbox (VMT): a processing and visualization suite for'</span>;<span class="keyword">...</span>
1539     <span class="string">'   moving-vessel ADCP measurements. Earth Surf. Process.'</span>;<span class="keyword">...</span>
1540     <span class="string">'   Landforms.doi: 10.1002/esp.3367'</span>};
1541 h = msgbox(messagestr,<span class="string">'About VMT'</span>); <span class="comment">%#ok&lt;NASGU&gt;</span>
1542 <span class="comment">% [EOF] menuAbout_Callback</span>
1543 
1544 
1545 
1546 
1547 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span>
1548 <span class="comment">% TOOLBAR CALLBACKS %</span>
1549 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span>
1550 
1551 <span class="comment">% --------------------------------------------------------------------</span>
1552 <a name="_sub50" href="#_subfunctions" class="code">function loadDataCallback(hObject, eventdata, handles)</a>
1553 <span class="comment">% Read Files into Data Structure using tfile.</span>
1554 
1555 <span class="comment">% Get the Application data:</span>
1556 <span class="comment">% -------------------------</span>
1557 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1558 guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
1559 
1560 <span class="comment">% Ask the user to select files:</span>
1561 <span class="comment">% -----------------------------</span>
1562 current_file = fullfile(guiprefs.ascii_path,guiprefs.ascii_file{1});
1563 [filename,pathname] = uigetfile({<span class="string">'*_ASC.TXT'</span>,<span class="string">'ASCII (*_ASC.TXT)'</span>}, <span class="keyword">...</span>
1564     <span class="string">'Select the ASCII Output Files'</span>, <span class="keyword">...</span>
1565     current_file, <span class="keyword">...</span>
1566     <span class="string">'MultiSelect'</span>,<span class="string">'on'</span>);
1567 
1568 <span class="keyword">if</span> ischar(pathname) <span class="comment">% The user did not hit &quot;Cancel&quot;</span>
1569     guiparams.data_folder = pathname;
1570     <span class="keyword">if</span> ischar(filename)
1571         filename = {filename};
1572     <span class="keyword">end</span>
1573     guiparams.data_files = filename;
1574     guiparams.mat_file = <span class="string">''</span>;
1575     
1576     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1577     
1578    
1579     
1580     <span class="comment">% Update the preferences:</span>
1581     <span class="comment">% -----------------------</span>
1582     guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
1583     guiprefs.ascii_path = pathname;
1584     guiprefs.ascii_file = filename;
1585     setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
1586     <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'ascii'</span>)
1587     
1588     <span class="comment">% Push messages to Log Window:</span>
1589     <span class="comment">% ----------------------------</span>
1590     log_text = {<span class="keyword">...</span>
1591         <span class="string">''</span>;<span class="keyword">...</span>
1592         [<span class="string">'%--- '</span> datestr(now) <span class="string">' ---%'</span>];<span class="keyword">...</span>
1593         <span class="string">'Current Project Directory:'</span>;<span class="keyword">...</span>
1594         guiparams.data_folder;
1595         <span class="string">'Loading the following files into memory:'</span>;<span class="keyword">...</span>
1596         char(filename)};
1597     statusLogging(handles.LogWindow, log_text)
1598     
1599     <span class="comment">% Read the file(s)</span>
1600     <span class="comment">% ----------------</span>
1601     [~,~,savefile,A,z] = <span class="keyword">...</span>
1602         <a href="VMT_ReadFiles.html" class="code" title="function [zPathName,zFileName,savefile,A,z] = VMT_ReadFiles(zPathName,zFileName)">VMT_ReadFiles</a>(guiparams.data_folder,guiparams.data_files);
1603     guiparams.savefile = savefile;
1604     guiparams.A        = A;
1605     guiparams.z        = z;
1606     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1607     
1608     <span class="comment">% Set the vertical grid node spacing</span>
1609     <span class="comment">% ----------------------------------</span>
1610     <span class="comment">% For RioGrande probes, use the bin size, else just use the default</span>
1611     <span class="comment">% Backwards compatible</span>
1612     <span class="keyword">if</span> A(1).Sup.wm ~= 3 <span class="comment">% RG</span>
1613         set(handles.VerticalGridNodeSpacing,<span class="string">'String'</span>,double(A(1).Sup.binSize_cm(1))/100)
1614     <span class="keyword">else</span> <span class="comment">% Older file, must be RG</span>
1615         set(handles.VerticalGridNodeSpacing,<span class="string">'String'</span>,0.4)
1616     <span class="keyword">end</span>
1617        
1618 <span class="comment">%</span>
1619 <span class="comment">%     % Preprocess the data:</span>
1620 <span class="comment">%     % --------------------</span>
1621 <span class="comment">%     A = VMT_PreProcess(z,A);</span>
1622 <span class="comment">%</span>
1623 <span class="comment">%     % Push messages to Log Window:</span>
1624 <span class="comment">%     % ----------------------------</span>
1625 <span class="comment">%     log_text = {...</span>
1626 <span class="comment">%         '   Preprocessing complete.';...</span>
1627 <span class="comment">%         '   Begin Data Processing...'};</span>
1628 <span class="comment">%     statusLogging(handles.LogWindow, log_text)</span>
1629 <span class="comment">%</span>
1630 <span class="comment">%     A(1).hgns = guiparams.horizontal_grid_node_spacing;</span>
1631 <span class="comment">%     A(1).wse  = guiparams.wse;  %Set the WSE to entered value</span>
1632 <span class="comment">%     [A,V,processing_log_text] = VMT_ProcessTransects(z,A,...</span>
1633 <span class="comment">%         guiparams.set_cross_section_endpoints,...</span>
1634 <span class="comment">%         guiparams.unit_discharge_correction);</span>
1635 <span class="comment">%</span>
1636 <span class="comment">%     % Push messages to Log Window:</span>
1637 <span class="comment">%     % ----------------------------</span>
1638 <span class="comment">%     statusLogging(handles.LogWindow, processing_log_text)</span>
1639 <span class="comment">%</span>
1640 <span class="comment">%     % Store the data:</span>
1641 <span class="comment">%     % ---------------</span>
1642 <span class="comment">%     guiparams.z = z;</span>
1643 <span class="comment">%     guiparams.A = A;</span>
1644 <span class="comment">%     guiparams.V = V;</span>
1645 <span class="comment">%     setappdata(handles.figure1,'guiparams',guiparams)</span>
1646     
1647           
1648     <span class="comment">% Update the GUI:</span>
1649     <span class="comment">% ---------------</span>
1650     <a href="#_sub95" class="code" title="subfunction set_enable(handles,enable_state)">set_enable</a>(handles,<span class="string">'fileloaded'</span>)
1651     
1652     <span class="comment">% If data are RG or SP, set vertical grid node spacing to bin size</span>
1653     
1654 <span class="keyword">end</span>
1655 <span class="comment">% [EOF] loadDataCallback</span>
1656 
1657 
1658 
1659 <span class="comment">% --------------------------------------------------------------------</span>
1660 <a name="_sub51" href="#_subfunctions" class="code">function saveDataCallback(hObject, eventdata, handles)</a>
1661 <span class="comment">% SaveMATFile_Callback(handles.SaveMATFile,eventdata,handles)</span>
1662 
1663 <span class="comment">% Get the Application data:</span>
1664 <span class="comment">% -------------------------</span>
1665 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1666 z   = guiparams.z;   <span class="comment">%#ok&lt;NASGU&gt;</span>
1667 A   = guiparams.A;   <span class="comment">%#ok&lt;NASGU&gt;</span>
1668 V   = guiparams.V;   <span class="comment">%#ok&lt;NASGU&gt;</span>
1669 Map = guiparams.Map; <span class="comment">%#ok&lt;NASGU&gt;</span>
1670 
1671 [the_file,the_path] = <span class="keyword">...</span>
1672     uiputfile({<span class="string">'*.mat'</span>,<span class="string">'MAT-Files (*.mat)'</span>}, <span class="keyword">...</span>
1673     <span class="string">'Save MAT-File'</span>, <span class="keyword">...</span>
1674     fullfile(guiparams.mat_path,guiparams.savefile));
1675 
1676 <span class="comment">% Save the processed data to a MAT file:</span>
1677 <span class="comment">% --------------------------------------</span>
1678 <span class="keyword">if</span> ischar(the_file)
1679     guiparams.mat_path = the_path;
1680     guiparams.mat_file = the_file;
1681     guiparams.savefile = the_file;
1682     
1683     <span class="comment">% Re-store the Application data:</span>
1684     <span class="comment">% ------------------------------</span>
1685     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1686     
1687     <span class="comment">% Update the preferences:</span>
1688     <span class="comment">% -----------------------</span>
1689     guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
1690     guiprefs.mat_path = the_path;
1691     guiprefs.mat_file = the_file;
1692     setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
1693     <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'mat'</span>)
1694     
1695     [pathstr,filename,extension] = fileparts([guiparams.mat_path guiparams.savefile]);
1696     savefile = fullfile(pathstr,[filename extension]);
1697     <span class="comment">%h = msgbox(['Saving processed data in MAT File ''' filename extension ''''], ...</span>
1698     <span class="comment">%    'Saving Processed Data File...'); %#ok&lt;NASGU&gt;</span>
1699     log_text = {<span class="keyword">...</span>
1700         <span class="string">'Saving Processed Data File...'</span>;<span class="keyword">...</span>
1701         savefile};
1702     statusLogging(handles.LogWindow,log_text)
1703     save(savefile,<span class="string">'A'</span>,<span class="string">'V'</span>,<span class="string">'z'</span>,<span class="string">'Map'</span>)
1704 <span class="keyword">end</span>
1705 
1706 <span class="comment">% [EOF] saveDataCallback</span>
1707 
1708 
1709 <span class="comment">% --------------------------------------------------------------------</span>
1710 <a name="_sub52" href="#_subfunctions" class="code">function saveBathymetryCallback(hObject, eventdata, handles)</a>
1711 
1712 <span class="comment">% Get the Application data:</span>
1713 <span class="comment">% -------------------------</span>
1714 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1715 z   = guiparams.z;
1716 A   = guiparams.A;
1717 <span class="comment">% V   = guiparams.V;   %#ok&lt;NASGU&gt;</span>
1718 <span class="comment">% Map = guiparams.Map; %#ok&lt;NASGU&gt;</span>
1719 
1720 <span class="comment">% Compute multibeam bathymetry:</span>
1721 <span class="comment">% -----------------------------</span>
1722 msgbox(<span class="string">'Processing Bathymetry...Please Be Patient'</span>,<span class="string">'VMT Status'</span>,<span class="string">'help'</span>,<span class="string">'replace'</span>)
1723 <span class="comment">%A = VMT_MBBathy(z,A,savefile,handles.beam_angle,handles.MagneticVariation,handles.WSE);</span>
1724 <a href="VMT_MBBathy.html" class="code" title="function [A] = VMT_MBBathy(z,A,savefile,beamAng,magVar,wsedata,saveaux)">VMT_MBBathy</a>(z,A,savefile, <span class="keyword">...</span>
1725     guiparams.beam_angle, <span class="keyword">...</span>
1726     guiparams.magnetic_variation, <span class="keyword">...</span>
1727     guiparams.wse, <span class="keyword">...</span>
1728     guiparams.output_auxiliary_data);
1729 
1730 msgbox(<span class="string">'Bathymetry Output Complete'</span>,<span class="string">'VMT Status'</span>,<span class="string">'help'</span>,<span class="string">'replace'</span>)
1731 
1732 <span class="comment">% [EOF] saveBathymetryCallback</span>
1733 
1734 <span class="comment">% --------------------------------------------------------------------</span>
1735 <a name="_sub53" href="#_subfunctions" class="code">function plottingParametersCallback(hObject, eventdata, handles)</a>
1736 
1737 <span class="comment">% Get the Application data:</span>
1738 <span class="comment">% -------------------------</span>
1739 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1740 
1741 [guiparams.english_units,guiparams.set_cross_section_endpoints,<span class="keyword">...</span>
1742     guiparams.presentation,guiparams.print] = <span class="keyword">...</span>
1743     plotParametersDialog(guiparams.english_units, <span class="keyword">...</span>
1744     guiparams.set_cross_section_endpoints,<span class="keyword">...</span>
1745     guiparams.presentation,guiparams.print,<span class="keyword">...</span>
1746     handles.figure1);
1747 
1748 <span class="comment">% Update the GUI:</span>
1749 <span class="comment">% ---------------</span>
1750 <span class="keyword">if</span> guiparams.english_units
1751     set(handles.menuMetric, <span class="string">'Checked'</span>,<span class="string">'off'</span>)
1752     set(handles.menuEnglish,<span class="string">'Checked'</span>,<span class="string">'on'</span>)
1753 <span class="keyword">else</span>
1754     set(handles.menuMetric, <span class="string">'Checked'</span>,<span class="string">'on'</span>)
1755     set(handles.menuEnglish,<span class="string">'Checked'</span>,<span class="string">'off'</span>)
1756 <span class="keyword">end</span>
1757 
1758 <span class="keyword">if</span> guiparams.set_cross_section_endpoints
1759     set(handles.menuCrossSectionEndpointAutomatic,<span class="string">'Checked'</span>,<span class="string">'off'</span>)
1760     set(handles.menuCrossSectionEndpointManual,   <span class="string">'Checked'</span>,<span class="string">'on'</span>)
1761 <span class="keyword">else</span>
1762     set(handles.menuCrossSectionEndpointAutomatic,<span class="string">'Checked'</span>,<span class="string">'on'</span>)
1763     set(handles.menuCrossSectionEndpointManual,   <span class="string">'Checked'</span>,<span class="string">'off'</span>)
1764 <span class="keyword">end</span>
1765 
1766 <span class="keyword">if</span> guiparams.presentation
1767     <a href="#_sub38" class="code" title="subfunction menuStylePresentation_Callback(hObject, eventdata, handles)">menuStylePresentation_Callback</a>(hObject, eventdata, handles)
1768 <span class="comment">%     set(handles.menuStylePrint,           'Checked','off')</span>
1769 <span class="comment">%     set(handles.menuStylePresentation,    'Checked','on')</span>
1770 <span class="comment">%     set(handles.menuPrintFormat,          'Checked','off')</span>
1771 <span class="comment">%     set(handles.menuPresentationFormat,   'Checked','on')</span>
1772 <span class="keyword">else</span>
1773     <a href="#_sub37" class="code" title="subfunction menuStylePrint_Callback(hObject, eventdata, handles)">menuStylePrint_Callback</a>(hObject, eventdata, handles)
1774 <span class="comment">%     set(handles.menuStylePrint,           'Checked','on')</span>
1775 <span class="comment">%     set(handles.menuStylePresentation,    'Checked','off')</span>
1776 <span class="comment">%     set(handles.menuPrintFormat,          'Checked','on')</span>
1777 <span class="comment">%     set(handles.menuPresentationFormat,   'Checked','off')</span>
1778 <span class="keyword">end</span>
1779 
1780 <span class="comment">% Re-store the Application data:</span>
1781 <span class="comment">% ------------------------------</span>
1782 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1783 
1784 <span class="comment">% [EOF] plottingParametersCallback</span>
1785 
1786 
1787 <span class="comment">% --------------------------------------------------------------------</span>
1788 <a name="_sub54" href="#_subfunctions" class="code">function processingParametersCallback(hObject, eventdata, handles)</a>
1789 
1790 <span class="comment">% Get the Application data:</span>
1791 <span class="comment">% -------------------------</span>
1792 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1793 z   = guiparams.z;   <span class="comment">%#ok&lt;NASGU&gt;</span>
1794 A   = guiparams.A;   <span class="comment">%#ok&lt;NASGU&gt;</span>
1795 V   = guiparams.V;   <span class="comment">%#ok&lt;NASGU&gt;</span>
1796 Map = guiparams.Map; <span class="comment">%#ok&lt;NASGU&gt;</span>
1797 
1798 <span class="comment">% [EOF] processingParametersCallback</span>
1799 
1800 
1801 <span class="comment">% --------------------------------------------------------------------</span>
1802 <a name="_sub55" href="#_subfunctions" class="code">function shiptracksPlotCallback(hObject, eventdata, handles)</a>
1803 <span class="comment">% Plot 1</span>
1804 
1805 <span class="comment">% Get the Application data:</span>
1806 <span class="comment">% -------------------------</span>
1807 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1808 z = guiparams.z;
1809 A = guiparams.A;
1810 V = guiparams.V; <span class="comment">%#ok&lt;NASGU&gt;</span>
1811 <span class="comment">% Map = guiparams.Map;</span>
1812 setends = guiparams.set_cross_section_endpoints;
1813 
1814 <span class="comment">% Preprocess the data:</span>
1815 <span class="comment">% --------------------</span>
1816 A = <a href="VMT_PreProcess.html" class="code" title="function A = VMT_PreProcess(z,A)">VMT_PreProcess</a>(z,A);
1817 
1818 <span class="comment">% Push messages to Log Window:</span>
1819 <span class="comment">% ----------------------------</span>
1820 log_text = {<span class="keyword">...</span>
1821     <span class="string">'   Preprocessing complete.'</span>;<span class="keyword">...</span>
1822     <span class="string">'   Begin Data Processing...'</span>};
1823 statusLogging(handles.LogWindow, log_text)
1824 
1825 <span class="comment">% Process the transects:</span>
1826 <span class="comment">% ----------------------</span>
1827 A(1).hgns = guiparams.horizontal_grid_node_spacing;
1828 A(1).vgns = guiparams.vertical_grid_node_spacing;
1829 A(1).wse  = guiparams.wse;  <span class="comment">%Set the WSE to entered value</span>
1830 [A,V,processing_log_text] = <a href="VMT_ProcessTransects.html" class="code" title="function [A,V,log_text] = VMT_ProcessTransects(z,A,setends,unitQcorrection)">VMT_ProcessTransects</a>(z,A,<span class="keyword">...</span>
1831     guiparams.set_cross_section_endpoints,guiparams.unit_discharge_correction);
1832 
1833 <span class="comment">% Compute the smoothed variables</span>
1834 <span class="comment">% ------------------------------</span>
1835 <span class="comment">% This is required so that the V struc is complete at any point during</span>
1836 <span class="comment">% runtime.</span>
1837 V = <a href="VMT_SmoothVar.html" class="code" title="function [V] = VMT_SmoothVar(V,hwin,vwin)">VMT_SmoothVar</a>(V, <span class="keyword">...</span>
1838     <span class="keyword">...</span><span class="comment">guiparams.contour, ...</span>
1839     guiparams.horizontal_smoothing_window, <span class="keyword">...</span>
1840     guiparams.vertical_smoothing_window);
1841 
1842 <span class="comment">% Push messages to Log Window:</span>
1843 <span class="comment">% ----------------------------</span>
1844 statusLogging(handles.LogWindow, processing_log_text)
1845 
1846 <span class="comment">% Store the data:</span>
1847 <span class="comment">% ---------------</span>
1848 guiparams.z = z;
1849 guiparams.A = A;
1850 guiparams.V = V;
1851 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
1852 
1853 <span class="comment">% Push messages to Log Window:</span>
1854 <span class="comment">% ----------------------------</span>
1855 log_text = {<span class="string">'Plotting Shiptracks (reprocessing)'</span>};
1856 statusLogging(handles.LogWindow, log_text)
1857 
1858 <span class="comment">% Create or replot the Shiptracks</span>
1859 <span class="comment">% -------------------------------</span>
1860 <span class="comment">% Grab the axes to the plot</span>
1861 <span class="comment">% axes(handles.Plot1Shiptracks);</span>
1862 <a href="VMT_PlotShiptracks.html" class="code" title="function hf = VMT_PlotShiptracks(A,V,z,setends,hf)">VMT_PlotShiptracks</a>(A,V,z,setends,handles.Plot1Shiptracks); <span class="comment">% PLOT 1</span>
1863 
1864 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%</span>
1865 <span class="comment">% New plot display window</span>
1866 <span class="comment">% h = VMT_CreatePlotDisplay('shiptracks');</span>
1867 <span class="comment">% h = figure(1); clf</span>
1868 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%</span>
1869 
1870 <span class="comment">% [EOF] shiptracksPlotCallback</span>
1871 
1872 
1873 <span class="comment">% --------------------------------------------------------------------</span>
1874 <a name="_sub56" href="#_subfunctions" class="code">function planviewPlotCallback(hObject, eventdata, handles)</a>
1875 <span class="comment">% Plot 2</span>
1876 
1877 <span class="comment">% Get the Application data:</span>
1878 <span class="comment">% -------------------------</span>
1879 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
1880 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
1881 
1882 <span class="keyword">if</span> iscell(guiparams.mat_file) <span class="comment">% Multiple MAT files loaded</span>
1883     <span class="comment">% Push messages to Log Window:</span>
1884     <span class="comment">% ----------------------------</span>
1885     log_text = {<span class="string">'Plotting Multiple Transects (Planview)'</span>};
1886     statusLogging(handles.LogWindow, log_text)
1887     
1888        
1889     <span class="comment">% Push plotting parameters to log window:</span>
1890     <span class="comment">% ---------------------------------------</span>
1891     log_text = {<span class="keyword">...</span>
1892         <span class="string">'Plan View Plotting Parameters'</span>;<span class="keyword">...</span>
1893         sprintf(<span class="string">'   Depth range %3.1f to %3.1f m'</span>,guiparams.depth_range_min, guiparams.depth_range_max);<span class="keyword">...</span>
1894         sprintf(<span class="string">'   Vector scale: %d'</span>,guiparams.vector_scale_plan_view);<span class="keyword">...</span>
1895         sprintf(<span class="string">'   Vector spacing: %d'</span>,guiparams.vector_spacing_plan_view);<span class="keyword">...</span>
1896         sprintf(<span class="string">'   Smoothing window size: %d'</span>,guiparams.smoothing_window_size);<span class="keyword">...</span>
1897         };
1898     statusLogging(handles.LogWindow, log_text)
1899     
1900     <span class="comment">% Plot the data:</span>
1901     <span class="comment">% --------------</span>
1902     z = [];
1903     A = [];
1904     V = [];
1905     Map = [];
1906     depth_range = [guiparams.depth_range_min guiparams.depth_range_max];
1907     [PVdata,~,log_text] = <a href="VMT_PlotPlanViewQuivers.html" class="code" title="function [PVdata,fig_planview_handle,log_text] = VMT_PlotPlanViewQuivers(z,A,V,Map,drng,ascale,QuiverSpacing,pvsmwin,pshore,plot_english,varargin)">VMT_PlotPlanViewQuivers</a>(z,A,V,Map, <span class="keyword">...</span>
1908         depth_range, <span class="keyword">...</span>
1909         guiparams.vector_scale_plan_view, <span class="keyword">...</span>
1910         guiparams.vector_spacing_plan_view, <span class="keyword">...</span>
1911         guiparams.smoothing_window_size, <span class="keyword">...</span>
1912         guiparams.display_shoreline, <span class="keyword">...</span>
1913         guiparams.english_units, <span class="keyword">...</span>
1914         guiparams.mat_file, <span class="keyword">...</span>
1915         guiparams.mat_path); <span class="comment">% PLOT2</span>
1916     statusLogging(handles.LogWindow, log_text)
1917     
1918     <span class="comment">% Plot a Shoreline Map:</span>
1919     <span class="comment">% ---------------------</span>
1920     <span class="keyword">if</span> guiparams.display_shoreline
1921         [guiprefs.shoreline_file,guiprefs.shoreline_path] = uigetfile(<span class="keyword">...</span>
1922             {<span class="string">'*.txt;*.csv'</span>,<span class="string">'All Text Files'</span>; <span class="string">'*.*'</span>,<span class="string">'All Files'</span>},<span class="keyword">...</span>
1923             <span class="string">'Select Map Text File'</span>,<span class="keyword">...</span>
1924             fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
1925         <span class="keyword">if</span> ischar(guiprefs.shoreline_file) <span class="comment">% User did not hit cancel</span>
1926             mapdata = dlmread(fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
1927             Map.UTMe   = mapdata(:,1);
1928             Map.UTMn   = mapdata(:,2);
1929             Map.infile = fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file);
1930             <span class="comment">%Map.UTMzone = zone;</span>
1931         <span class="keyword">else</span>
1932             Map = [];
1933         <span class="keyword">end</span>
1934         <a href="VMT_PlotShoreline.html" class="code" title="function VMT_PlotShoreline(Map)">VMT_PlotShoreline</a>(Map)
1935         log_text = {<span class="keyword">...</span>
1936             <span class="string">'   Loading map file.'</span>;<span class="keyword">...</span>
1937             <span class="string">'   Plotting shoreline.'</span><span class="keyword">...</span>
1938             };
1939         statusLogging(handles.LogWindow, log_text)
1940     <span class="keyword">else</span>
1941         Map = [];
1942     <span class="keyword">end</span>
1943     
1944 <span class="keyword">else</span>
1945     z = guiparams.z;
1946     A = guiparams.A;
1947     <span class="comment">% V = guiparams.V;</span>
1948     Map = guiparams.Map;
1949     
1950     <span class="comment">% Push messages to Log Window:</span>
1951     <span class="comment">% ----------------------------</span>
1952     log_text = {<span class="string">'Plotting Depth Averaged Vectors (reprocessing)'</span>};
1953     statusLogging(handles.LogWindow, log_text)
1954     
1955         
1956     <span class="comment">% Preprocess the data:</span>
1957     <span class="comment">% --------------------</span>
1958     A = <a href="VMT_PreProcess.html" class="code" title="function A = VMT_PreProcess(z,A)">VMT_PreProcess</a>(z,A);
1959     
1960     <span class="comment">% Process the transects:</span>
1961     <span class="comment">% ----------------------</span>
1962     A(1).hgns = guiparams.horizontal_grid_node_spacing;
1963     A(1).vgns = guiparams.vertical_grid_node_spacing;
1964     A(1).wse  = guiparams.wse;  <span class="comment">%Set the WSE to entered value</span>
1965     [A,V,processing_log_text] = <a href="VMT_ProcessTransects.html" class="code" title="function [A,V,log_text] = VMT_ProcessTransects(z,A,setends,unitQcorrection)">VMT_ProcessTransects</a>(z,A,<span class="keyword">...</span>
1966         guiparams.set_cross_section_endpoints,guiparams.unit_discharge_correction);
1967     
1968     <span class="comment">% Compute the smoothed variables</span>
1969     <span class="comment">% ------------------------------</span>
1970     <span class="comment">% This is required so that the V struc is complete at any point during</span>
1971     <span class="comment">% runtime.</span>
1972     V = <a href="VMT_SmoothVar.html" class="code" title="function [V] = VMT_SmoothVar(V,hwin,vwin)">VMT_SmoothVar</a>(V, <span class="keyword">...</span>
1973         <span class="keyword">...</span><span class="comment">guiparams.contour, ...</span>
1974         guiparams.horizontal_smoothing_window, <span class="keyword">...</span>
1975         guiparams.vertical_smoothing_window);
1976     
1977     <span class="comment">% Push messages to Log Window:</span>
1978     <span class="comment">% ----------------------------</span>
1979     statusLogging(handles.LogWindow, processing_log_text)
1980     
1981     <span class="comment">% Plot the cross section:</span>
1982     <span class="comment">% -----------------------</span>
1983     log_text = {<span class="keyword">...</span>
1984         <span class="string">'Plan View Plotting Parameters'</span>;<span class="keyword">...</span>
1985         sprintf(<span class="string">'   Depth range %3.1f to %3.1f m'</span>,guiparams.depth_range_min, guiparams.depth_range_max);<span class="keyword">...</span>
1986         sprintf(<span class="string">'   Vector scale: %d'</span>,guiparams.vector_scale_plan_view);<span class="keyword">...</span>
1987         sprintf(<span class="string">'   Vector spacing: %d'</span>,guiparams.vector_spacing_plan_view);<span class="keyword">...</span>
1988         sprintf(<span class="string">'   Smoothing window size: %d'</span>,guiparams.smoothing_window_size);<span class="keyword">...</span>
1989         };
1990     statusLogging(handles.LogWindow, log_text)
1991     
1992     <span class="comment">% Plot the data:</span>
1993     <span class="comment">% --------------</span>
1994     <span class="comment">%msgbox('Plotting Plan View','VMT Status','help','replace');</span>
1995     depth_range = [guiparams.depth_range_min guiparams.depth_range_max];
1996     
1997     
1998     [PVdata,~,log_text] = <a href="VMT_PlotPlanViewQuivers.html" class="code" title="function [PVdata,fig_planview_handle,log_text] = VMT_PlotPlanViewQuivers(z,A,V,Map,drng,ascale,QuiverSpacing,pvsmwin,pshore,plot_english,varargin)">VMT_PlotPlanViewQuivers</a>(z,A,V,Map, <span class="keyword">...</span>
1999         depth_range, <span class="keyword">...</span>
2000         guiparams.vector_scale_plan_view, <span class="keyword">...</span>
2001         guiparams.vector_spacing_plan_view, <span class="keyword">...</span>
2002         guiparams.smoothing_window_size, <span class="keyword">...</span>
2003         guiparams.display_shoreline, <span class="keyword">...</span>
2004         guiparams.english_units, <span class="keyword">...</span>
2005         guiparams.mat_file, <span class="keyword">...</span>
2006         guiparams.mat_path); <span class="comment">% PLOT2</span>
2007     statusLogging(handles.LogWindow, log_text)
2008     
2009     <span class="comment">% Plot a Shoreline Map:</span>
2010     <span class="comment">% ---------------------</span>
2011     <span class="keyword">if</span> guiparams.display_shoreline
2012         [guiprefs.shoreline_file,guiprefs.shoreline_path] = uigetfile(<span class="keyword">...</span>
2013             {<span class="string">'*.txt;*.csv'</span>,<span class="string">'All Text Files'</span>; <span class="string">'*.*'</span>,<span class="string">'All Files'</span>},<span class="keyword">...</span>
2014             <span class="string">'Select Map Text File'</span>,<span class="keyword">...</span>
2015             fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
2016         <span class="keyword">if</span> ischar(guiprefs.shoreline_file) <span class="comment">% User did not hit cancel</span>
2017             mapdata = dlmread(fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
2018             Map.UTMe   = mapdata(:,1);
2019             Map.UTMn   = mapdata(:,2);
2020             Map.infile = fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file);
2021             <span class="comment">%Map.UTMzone = zone;</span>
2022         <span class="keyword">else</span>
2023             Map = [];
2024         <span class="keyword">end</span>
2025         <a href="VMT_PlotShoreline.html" class="code" title="function VMT_PlotShoreline(Map)">VMT_PlotShoreline</a>(Map)
2026         log_text = {<span class="keyword">...</span>
2027             <span class="string">'   Loading map file.'</span>;<span class="keyword">...</span>
2028             <span class="string">'   Plotting shoreline.'</span><span class="keyword">...</span>
2029             };
2030         statusLogging(handles.LogWindow, log_text)
2031     <span class="keyword">else</span>
2032         Map = [];
2033     <span class="keyword">end</span>
2034     
2035 <span class="keyword">end</span>
2036 
2037 <span class="keyword">if</span> guiparams.add_background
2038     [guiprefs,log_text] = <a href="VMT_OverlayDOQQ.html" class="code" title="function [guiprefs,log_text] = VMT_OverlayDOQQ(guiprefs,varargin)">VMT_OverlayDOQQ</a>(guiprefs);
2039     statusLogging(handles.LogWindow, log_text)
2040 <span class="keyword">end</span>
2041 
2042 <span class="comment">% Update guiparams</span>
2043 <span class="comment">% ----------------</span>
2044 guiparams.z   = z;
2045 guiparams.A   = A;
2046 guiparams.V   = V;
2047 guiparams.Map = Map;
2048 guiparams.iric_anv_planview_data = PVdata;
2049 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams);
2050 
2051 <span class="comment">% Update preferences</span>
2052 <span class="comment">% ------------------</span>
2053 setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
2054 <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'shoreline'</span>)
2055 <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'aerial'</span>)
2056 
2057 <span class="comment">% Force plot to be formated properly</span>
2058 <span class="comment">% ----------------------------------</span>
2059 <span class="keyword">if</span> guiparams.presentation
2060     <a href="#_sub38" class="code" title="subfunction menuStylePresentation_Callback(hObject, eventdata, handles)">menuStylePresentation_Callback</a>(hObject, eventdata, handles)
2061 <span class="keyword">else</span>
2062     <a href="#_sub37" class="code" title="subfunction menuStylePrint_Callback(hObject, eventdata, handles)">menuStylePrint_Callback</a>(hObject, eventdata, handles)
2063 <span class="keyword">end</span>
2064 <span class="keyword">switch</span> guiparams.renderer
2065     <span class="keyword">case</span> <span class="string">'OpenGL'</span>
2066         <a href="#_sub18" class="code" title="subfunction menuOpenGL_Callback(hObject, eventdata, handles)">menuOpenGL_Callback</a>(hObject, eventdata, handles)
2067     <span class="keyword">case</span> <span class="string">'painters'</span>
2068         <a href="#_sub19" class="code" title="subfunction menuPainters_Callback(hObject, eventdata, handles)">menuPainters_Callback</a>(hObject, eventdata, handles)
2069     <span class="keyword">case</span> <span class="string">'zbuffer'</span>
2070         <a href="#_sub20" class="code" title="subfunction menuZbuffer_Callback(hObject, eventdata, handles)">menuZbuffer_Callback</a>(hObject, eventdata, handles)
2071 <span class="keyword">end</span>
2072 
2073 <span class="comment">% Focus the figure</span>
2074 <span class="comment">% ----------------</span>
2075 hff = findobj(<span class="string">'name'</span>,<span class="string">'Plan View Map'</span>);
2076 <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
2077     figure(hff)
2078 <span class="keyword">end</span>
2079 
2080 <span class="comment">% Start the Graphics Control Gui</span>
2081 <span class="comment">% ------------------------------</span>
2082 VMT_GraphicsControl
2083 
2084 <span class="comment">% [EOF] planviewPlotCallback</span>
2085 
2086 
2087 <span class="comment">% --------------------------------------------------------------------</span>
2088 <a name="_sub57" href="#_subfunctions" class="code">function crosssectionPlotCallback(hObject, eventdata, handles)</a>
2089 <span class="comment">% Plot 3</span>
2090 
2091 <span class="comment">% Get the Application data:</span>
2092 <span class="comment">% -------------------------</span>
2093 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2094 z = guiparams.z;
2095 A = guiparams.A;
2096 <span class="comment">% V = guiparams.V;</span>
2097 <span class="comment">% Map = guiparams.Map;</span>
2098 
2099 <span class="comment">% Preprocess the data:</span>
2100 <span class="comment">% --------------------</span>
2101 A = <a href="VMT_PreProcess.html" class="code" title="function A = VMT_PreProcess(z,A)">VMT_PreProcess</a>(z,A);
2102 
2103 <span class="comment">% Push messages to Log Window:</span>
2104 <span class="comment">% ----------------------------</span>
2105 log_text = {<span class="string">'Plotting Cross Section (reprocessing)'</span>};
2106 statusLogging(handles.LogWindow, log_text)
2107 
2108 <span class="comment">% Process the transects:</span>
2109 <span class="comment">% ----------------------</span>
2110 A(1).hgns = guiparams.horizontal_grid_node_spacing;
2111 A(1).vgns = guiparams.vertical_grid_node_spacing;
2112 A(1).wse  = guiparams.wse;  <span class="comment">%Set the WSE to entered value</span>
2113 [A,V,processing_log_text] = <a href="VMT_ProcessTransects.html" class="code" title="function [A,V,log_text] = VMT_ProcessTransects(z,A,setends,unitQcorrection)">VMT_ProcessTransects</a>(z,A,<span class="keyword">...</span>
2114     guiparams.set_cross_section_endpoints,guiparams.unit_discharge_correction);
2115 
2116 <span class="comment">% Push messages to Log Window:</span>
2117 <span class="comment">% ----------------------------</span>
2118 statusLogging(handles.LogWindow, processing_log_text)
2119 
2120 <span class="comment">% Plot the cross section:</span>
2121 <span class="comment">% -----------------------</span>
2122 log_text = {<span class="keyword">...</span>
2123     <span class="string">'Cross Section Plotting Parameters'</span>;<span class="keyword">...</span>
2124     sprintf(<span class="string">'   Contour variable: %s'</span>          ,guiparams.contours(guiparams.idx_contour).string);<span class="keyword">...</span>
2125     sprintf(<span class="string">'   Vertical exaggeration: %d'</span>     ,guiparams.vertical_exaggeration);<span class="keyword">...</span>
2126     sprintf(<span class="string">'   Vector scale: %3.1f'</span>           ,guiparams.vector_scale_cross_section);<span class="keyword">...</span>
2127     sprintf(<span class="string">'   Horizontal vector spacing: %d'</span> ,guiparams.horizontal_vector_spacing);<span class="keyword">...</span>
2128     sprintf(<span class="string">'   Vertical vector spacing: %d'</span>   ,guiparams.vertical_vector_spacing);<span class="keyword">...</span>
2129     sprintf(<span class="string">'   Horizontal smooting window: %d'</span>,guiparams.horizontal_smoothing_window);<span class="keyword">...</span>
2130     sprintf(<span class="string">'   Vertical smoothing window: %d'</span> ,guiparams.vertical_smoothing_window);<span class="keyword">...</span>
2131     };
2132 <span class="keyword">if</span> guiparams.plot_secondary_flow_vectors
2133     log_text = vertcat(log_text, {<span class="keyword">...</span>
2134         sprintf(<span class="string">'   Vector variable: %s'</span>,guiparams.secondary_flows(guiparams.idx_secondary_flow_vector_variable).string);<span class="keyword">...</span>
2135         sprintf(<span class="string">'   Inc. vertical component?: %d'</span>,guiparams.include_vertical_velocity)<span class="keyword">...</span>
2136         });
2137 <span class="keyword">end</span>
2138 <span class="comment">% Push messages to Log Window:</span>
2139 <span class="comment">% ----------------------------</span>
2140 statusLogging(handles.LogWindow, log_text)
2141 
2142 <span class="keyword">if</span> guiparams.plot_secondary_flow_vectors
2143     <span class="comment">%msgbox('Plotting Cross Section','VMT Status','help','replace')</span>
2144 <span class="comment">%     V = VMT_SmoothVar(V, ...</span>
2145 <span class="comment">%         ...guiparams.contour, ...</span>
2146 <span class="comment">%         guiparams.horizontal_smoothing_window, ...</span>
2147 <span class="comment">%         guiparams.vertical_smoothing_window);</span>
2148     V = <a href="VMT_SmoothVar.html" class="code" title="function [V] = VMT_SmoothVar(V,hwin,vwin)">VMT_SmoothVar</a>(V, <span class="keyword">...</span>
2149         <span class="keyword">...</span><span class="comment">guiparams.secondary_flow_vector_variable, ...</span>
2150         guiparams.horizontal_smoothing_window, <span class="keyword">...</span>
2151         guiparams.vertical_smoothing_window);
2152     [~,A,V,plot_cont_log_text] = <a href="VMT_PlotXSContQuiver.html" class="code" title="function [z,A,V,log_text] = VMT_PlotXSContQuiver(z,A,V,var,sf,exag,qspchorz,qspcvert,secvecvar,vvelcomp,plot_english,varargin)">VMT_PlotXSContQuiver</a>(z,A,V, <span class="keyword">...</span>
2153         guiparams.contour, <span class="keyword">...</span>
2154         guiparams.vector_scale_cross_section, <span class="keyword">...</span>
2155         guiparams.vertical_exaggeration, <span class="keyword">...</span>
2156         guiparams.horizontal_vector_spacing, <span class="keyword">...</span>
2157         guiparams.vertical_vector_spacing, <span class="keyword">...</span>
2158         guiparams.secondary_flow_vector_variable, <span class="keyword">...</span>
2159         guiparams.include_vertical_velocity, <span class="keyword">...</span>
2160         guiparams.english_units); <span class="comment">%#ok&lt;ASGLU&gt; % PLOT3</span>
2161     
2162 <span class="keyword">elseif</span> ~guiparams.plot_secondary_flow_vectors
2163     V = <a href="VMT_SmoothVar.html" class="code" title="function [V] = VMT_SmoothVar(V,hwin,vwin)">VMT_SmoothVar</a>(V, <span class="keyword">...</span>
2164         <span class="keyword">...</span><span class="comment">guiparams.contour, ...</span>
2165         guiparams.horizontal_smoothing_window, <span class="keyword">...</span>
2166         guiparams.vertical_smoothing_window);
2167     
2168     [~,A,V,zmin,zmax,plot_cont_log_text] = <a href="VMT_PlotXSCont.html" class="code" title="function [z,A,V,zmin,zmax,log_text,fig_contour_handle] = VMT_PlotXSCont(z,A,V,var,exag,plot_english)">VMT_PlotXSCont</a>(z,A,V, <span class="keyword">...</span>
2169         guiparams.contour, <span class="keyword">...</span>
2170         guiparams.vertical_exaggeration, <span class="keyword">...</span>
2171         guiparams.english_units);  <span class="comment">%#ok&lt;ASGLU&gt;</span>
2172     
2173     guiparams.zmin = zmin;
2174     guiparams.zmax = zmax;
2175     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2176 <span class="keyword">end</span>
2177 
2178 <span class="comment">% Force plot to be formated properly</span>
2179 <span class="comment">% ----------------------------------</span>
2180 <span class="keyword">if</span> guiparams.presentation
2181     <a href="#_sub38" class="code" title="subfunction menuStylePresentation_Callback(hObject, eventdata, handles)">menuStylePresentation_Callback</a>(hObject, eventdata, handles)
2182 <span class="keyword">else</span>
2183     <a href="#_sub37" class="code" title="subfunction menuStylePrint_Callback(hObject, eventdata, handles)">menuStylePrint_Callback</a>(hObject, eventdata, handles)
2184 <span class="keyword">end</span>
2185 <span class="keyword">switch</span> guiparams.renderer
2186     <span class="keyword">case</span> <span class="string">'OpenGL'</span>
2187         <a href="#_sub18" class="code" title="subfunction menuOpenGL_Callback(hObject, eventdata, handles)">menuOpenGL_Callback</a>(hObject, eventdata, handles)
2188     <span class="keyword">case</span> <span class="string">'painters'</span>
2189         <a href="#_sub19" class="code" title="subfunction menuPainters_Callback(hObject, eventdata, handles)">menuPainters_Callback</a>(hObject, eventdata, handles)
2190     <span class="keyword">case</span> <span class="string">'zbuffer'</span>
2191         <a href="#_sub20" class="code" title="subfunction menuZbuffer_Callback(hObject, eventdata, handles)">menuZbuffer_Callback</a>(hObject, eventdata, handles)
2192 <span class="keyword">end</span>
2193 
2194 <span class="comment">% Focus the figure</span>
2195 <span class="comment">% ----------------</span>
2196 hff = findobj(<span class="string">'name'</span>,<span class="string">'Mean Cross Section Contour'</span>);
2197 <span class="keyword">if</span> ~isempty(hff) &amp;&amp;  ishandle(hff)
2198     figure(hff)
2199 <span class="keyword">end</span>
2200 
2201 <span class="comment">% Re-store the Application data:</span>
2202 <span class="comment">% ------------------------------</span>
2203 guiparams.V = V;
2204 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2205 
2206 <span class="comment">% Start the Graphics Control Gui</span>
2207 <span class="comment">% ------------------------------</span>
2208 VMT_GraphicsControl
2209 
2210 <span class="comment">% Push messages to Log Window:</span>
2211 <span class="comment">% ----------------------------</span>
2212 statusLogging(handles.LogWindow, plot_cont_log_text)
2213 <span class="comment">% msgbox('Plotting Complete','VMT Status','help','replace')</span>
2214 
2215 <span class="comment">% [EOF] crosssectionPlotCallback</span>
2216 
2217 
2218 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2219 <span class="comment">% DATA EXPORT CALLBACKS %</span>
2220 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2221 
2222 <span class="comment">% --------------------------------------------------------------------</span>
2223 <a name="_sub58" href="#_subfunctions" class="code">function SaveMATFile_Callback(hObject, eventdata, handles)</a>
2224 <span class="comment">% saveDataCallback(hObject, eventdata, handles)</span>
2225 
2226 <span class="comment">% Get the Application data:</span>
2227 <span class="comment">% -------------------------</span>
2228 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2229 z   = guiparams.z;   <span class="comment">%#ok&lt;NASGU&gt;</span>
2230 A   = guiparams.A;   <span class="comment">%#ok&lt;NASGU&gt;</span>
2231 V   = guiparams.V;   <span class="comment">%#ok&lt;NASGU&gt;</span>
2232 Map = guiparams.Map; <span class="comment">%#ok&lt;NASGU&gt;</span>
2233 
2234 [the_file,the_path] = <span class="keyword">...</span>
2235     uiputfile({<span class="string">'*.mat'</span>,<span class="string">'MAT-Files (*.mat)'</span>}, <span class="keyword">...</span>
2236     <span class="string">'Save MAT-File'</span>, <span class="keyword">...</span>
2237     fullfile(guiparams.mat_path,guiparams.savefile));
2238 
2239 <span class="comment">% Save the processed data to a MAT file:</span>
2240 <span class="comment">% --------------------------------------</span>
2241 <span class="keyword">if</span> ischar(the_file)
2242     guiparams.mat_path = the_path;
2243     guiparams.mat_file = the_file;
2244     guiparams.savefile = the_file;
2245     
2246     <span class="comment">% Re-store the Application data:</span>
2247     <span class="comment">% ------------------------------</span>
2248     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2249     
2250     <span class="comment">% Update the preferences:</span>
2251     <span class="comment">% -----------------------</span>
2252     guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
2253     guiprefs.mat_path = the_path;
2254     guiprefs.mat_file = the_file;
2255     setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
2256     <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'mat'</span>)
2257     
2258     [~,filename,extension] = fileparts(guiparams.savefile);
2259     savefile = [filename extension];
2260     h = msgbox([<span class="string">'Saving processed data in MAT File '''</span> savefile <span class="string">''''</span>], <span class="keyword">...</span>
2261         <span class="string">'Saving Processed Data File...'</span>); <span class="comment">%#ok&lt;NASGU&gt;</span>
2262     disp(<span class="string">'Saving Processed Data File...'</span>)
2263     disp(savefile)
2264     save(savefile,<span class="string">'A'</span>,<span class="string">'V'</span>,<span class="string">'z'</span>,<span class="string">'Map'</span>)
2265 <span class="keyword">end</span>
2266 
2267 <span class="comment">% [EOF] SaveMATFile_Callback</span>
2268 
2269 
2270 <span class="comment">% --------------------------------------------------------------------</span>
2271 <a name="_sub59" href="#_subfunctions" class="code">function SaveTecplotFile_Callback(hObject, eventdata, handles)</a>
2272 
2273 <span class="comment">% Get the Application data:</span>
2274 <span class="comment">% -------------------------</span>
2275 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2276 <span class="comment">% z   = guiparams.z;</span>
2277 <span class="comment">% A   = guiparams.A;</span>
2278 V   = guiparams.V;
2279 <span class="comment">% Map = guiparams.Map;</span>
2280 
2281 [the_file,the_path] = <span class="keyword">...</span>
2282     uiputfile({<span class="string">'*.dat'</span>,<span class="string">'Tecplot Files (*.dat)'</span>}, <span class="keyword">...</span>
2283     <span class="string">'Save Tecplot File'</span>, <span class="keyword">...</span>
2284     fullfile(guiparams.tecplot_path,guiparams.tecplot_file));
2285 
2286 <span class="comment">% Output the data (no smoothing) to Tecplot:</span>
2287 <span class="comment">% ------------------------------------------</span>
2288 <span class="keyword">if</span> ischar(the_file)
2289     guiparams.tecplot_path = the_path;
2290     guiparams.tecplot_file = the_file;
2291     
2292     <span class="comment">% Re-store the Application data:</span>
2293     <span class="comment">% ------------------------------</span>
2294     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2295     
2296     <span class="comment">% Update the preferences:</span>
2297     <span class="comment">% -----------------------</span>
2298     guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
2299     guiprefs.tecplot_path = the_path;
2300     guiprefs.tecplot_file = the_file;
2301     setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
2302     <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'tecplot'</span>)
2303     
2304     <span class="comment">% Push to log window</span>
2305     <span class="comment">% ------------------</span>
2306     log_text = {<span class="keyword">...</span>
2307         <span class="string">'Exporting Data to Tecplot (*.dat) File...'</span>;<span class="keyword">...</span>
2308         <span class="string">'Directory:'</span>;<span class="keyword">...</span>
2309         the_path;<span class="keyword">...</span>
2310         [<span class="string">'Filename: '</span> the_file]};
2311     statusLogging(handles.LogWindow,log_text)
2312         
2313     <span class="keyword">if</span> isempty(V)
2314         A = guiparams.A;
2315         A(1).hgns = guiparams.horizontal_grid_node_spacing;
2316         A(1).vgns = guiparams.vertical_grid_node_spacing;
2317         A(1).wse  = guiparams.wse;  <span class="comment">%Set the WSE to entered value</span>
2318         [~,V,processing_log_text] = <a href="VMT_ProcessTransects.html" class="code" title="function [A,V,log_text] = VMT_ProcessTransects(z,A,setends,unitQcorrection)">VMT_ProcessTransects</a>(z,A,<span class="keyword">...</span>
2319             guiparams.set_cross_section_endpoints,<span class="keyword">...</span>
2320             guiparams.unit_discharge_correction);
2321     <span class="keyword">end</span>
2322     <a href="VMT_BuildTecplotFile.html" class="code" title="function VMT_BuildTecplotFile(V,savefile)">VMT_BuildTecplotFile</a>(V,fullfile(guiparams.tecplot_path,guiparams.tecplot_file));
2323     
2324     <span class="comment">% Push to log window</span>
2325     <span class="comment">% ------------------</span>
2326     log_text = {<span class="string">'Exporting XS Bathy Data to Tecplot (*.dat) File...'</span>};
2327     statusLogging(handles.LogWindow,log_text)
2328     
2329     <a href="VMT_BuildTecplotFile_XSBathy.html" class="code" title="function VMT_BuildTecplot_XSBathy(V,savefile)">VMT_BuildTecplotFile_XSBathy</a>(V,fullfile(guiparams.tecplot_path,guiparams.tecplot_file));
2330     
2331     <span class="comment">% Push to log window</span>
2332     <span class="comment">% ------------------</span>
2333     log_text = {<span class="string">'Tecplot Export Complete'</span>};
2334     statusLogging(handles.LogWindow,log_text)
2335    
2336 <span class="keyword">end</span>
2337 
2338 <span class="comment">% [EOF] SaveTechplotFile_Callback</span>
2339 
2340 
2341 <span class="comment">% --------------------------------------------------------------------</span>
2342 <a name="_sub60" href="#_subfunctions" class="code">function SaveGoogleEarthFile_Callback(hObject, eventdata, handles)</a>
2343 
2344 <span class="comment">% Get the Application data:</span>
2345 <span class="comment">% -------------------------</span>
2346 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2347 <span class="comment">% z   = guiparams.z;</span>
2348 A   = guiparams.A;
2349 V   = guiparams.V;
2350 Map = guiparams.Map; <span class="comment">%#ok&lt;NASGU&gt;</span>
2351 
2352 [the_file,the_path] = <span class="keyword">...</span>
2353     uiputfile({<span class="string">'*.kmz'</span>,<span class="string">'Google Earth Files (*.kmz)'</span>}, <span class="keyword">...</span>
2354     <span class="string">'Save Google Earth File'</span>, <span class="keyword">...</span>
2355     fullfile(guiparams.kmz_path,guiparams.kmz_file));
2356 
2357 <span class="comment">% Save the processed data to a Google Earth (KMZ) file:</span>
2358 <span class="comment">% -----------------------------------------------------</span>
2359 <span class="keyword">if</span> ischar(the_file)
2360     guiparams.kmz_path = the_path;
2361     guiparams.kmz_file = the_file;
2362     
2363     <span class="comment">% Re-store the Application data:</span>
2364     <span class="comment">% ------------------------------</span>
2365     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2366     
2367     <span class="comment">% Update the preferences:</span>
2368     <span class="comment">% -----------------------</span>
2369     guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
2370     guiprefs.kmz_path = the_path;
2371     guiprefs.kmz_file = the_file;
2372     setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
2373     <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'kmz'</span>)
2374     
2375     <span class="comment">%     if guiparams.display_shoreline</span>
2376     <span class="comment">%         VMT_Shoreline2GE_3D(A,Map, ...</span>
2377     <span class="comment">%                             guiparams.vertical_exaggeration, ...</span>
2378     <span class="comment">%                             guiparams.vertical_offset);</span>
2379     <span class="comment">%     end</span>
2380     <span class="keyword">if</span> isempty(V)
2381         A = guiparams.A;
2382         A(1).hgns = guiparams.horizontal_grid_node_spacing;
2383         A(1).vgns = guiparams.vertical_grid_node_spacing;
2384         A(1).wse  = guiparams.wse;  <span class="comment">%Set the WSE to entered value</span>
2385         [~,V,processing_log_text] = <a href="VMT_ProcessTransects.html" class="code" title="function [A,V,log_text] = VMT_ProcessTransects(z,A,setends,unitQcorrection)">VMT_ProcessTransects</a>(z,A,<span class="keyword">...</span>
2386             guiparams.set_cross_section_endpoints,<span class="keyword">...</span>
2387             guiparams.unit_discharge_correction);
2388     <span class="keyword">end</span>
2389     <a href="VMT_MeanXS2GE_3D.html" class="code" title="function VMT_MeanXS2GE_3D(A,V,pathstr,filestr,vscale,voffset)">VMT_MeanXS2GE_3D</a>(A,V,[], <span class="keyword">...</span>
2390         fullfile(guiparams.kmz_path,guiparams.kmz_file), <span class="keyword">...</span>
2391         guiparams.vertical_exaggeration, <span class="keyword">...</span>
2392         guiparams.vertical_offset);
2393 <span class="keyword">end</span>
2394 
2395 <span class="comment">% [EOF] SaveGoogleEarthFile_Callback</span>
2396 
2397 
2398 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2399 <span class="comment">% DATA EXPORT/BATHYMETRY CALLBACKS %</span>
2400 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2401 
2402 <span class="comment">% --------------------------------------------------------------------</span>
2403 <a name="_sub61" href="#_subfunctions" class="code">function ExportMultibeamBathymetry_Callback(hObject, eventdata, handles)</a>
2404 
2405 <span class="comment">% Get the Application data:</span>
2406 <span class="comment">% -------------------------</span>
2407 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2408 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
2409 z = guiparams.z;
2410 A = guiparams.A;
2411 V = guiparams.V; <span class="comment">%#ok&lt;NASGU&gt;</span>
2412 <span class="comment">% Map = guiparams.Map;</span>
2413 setends = guiparams.set_cross_section_endpoints;
2414 
2415 [the_file,the_path] = <span class="keyword">...</span>
2416     uiputfile({<span class="string">'*.csv'</span>,<span class="string">'Multibeam Bathymetry Files (*.csv)'</span>}, <span class="keyword">...</span>
2417     <span class="string">'Export Multibeam Bathymetry'</span>, <span class="keyword">...</span>
2418     fullfile(guiprefs.multibeambathymetry_path, <span class="keyword">...</span>
2419     guiprefs.multibeambathymetry_file));
2420 
2421 <span class="keyword">if</span> ischar(the_file)
2422     guiparams.multibeambathymetry_path = the_path;
2423     guiparams.multibeambathymetry_file = the_file;
2424     
2425     <span class="comment">% Re-store the Application data:</span>
2426     <span class="comment">% ------------------------------</span>
2427     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2428     
2429     <span class="comment">% Update the preferences:</span>
2430     <span class="comment">% -----------------------</span>
2431     guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
2432     guiprefs.multibeambathymetry_path = the_path;
2433     guiprefs.multibeambathymetry_file = the_file;
2434     setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
2435     <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'multibeambathymetry'</span>)
2436     
2437     <span class="keyword">if</span> guiparams.output_auxiliary_data
2438     <span class="keyword">end</span>
2439     
2440     <span class="comment">%msgbox('Processing Bathymetry...Please Be Patient','VMT Status','help','replace')</span>
2441     
2442     savefile = fullfile(guiparams.multibeambathymetry_path, <span class="keyword">...</span>
2443         guiparams.multibeambathymetry_file);
2444     
2445     log_text = {<span class="string">'Multibeam bathymetry file saved to:'</span>;<span class="keyword">...</span>
2446         [<span class="string">'   '</span> savefile]};
2447     statusLogging(handles.LogWindow,log_text)
2448     
2449     <span class="comment">% Process the transects:</span>
2450     <span class="comment">% ----------------------</span>
2451     A(1).hgns = guiparams.horizontal_grid_node_spacing;
2452     A(1).vgns = guiparams.vertical_grid_node_spacing;
2453     A(1).wse  = guiparams.wse;  <span class="comment">%Set the WSE to entered value</span>
2454     [A,V,processing_log_text] = <a href="VMT_ProcessTransects.html" class="code" title="function [A,V,log_text] = VMT_ProcessTransects(z,A,setends,unitQcorrection)">VMT_ProcessTransects</a>(z,A,<span class="keyword">...</span>
2455         guiparams.set_cross_section_endpoints,guiparams.unit_discharge_correction);
2456     
2457     <span class="comment">% Compute the smoothed variables</span>
2458     <span class="comment">% ------------------------------</span>
2459     <span class="comment">% This is required so that the V struc is complete at any point during</span>
2460     <span class="comment">% runtime.</span>
2461     V = <a href="VMT_SmoothVar.html" class="code" title="function [V] = VMT_SmoothVar(V,hwin,vwin)">VMT_SmoothVar</a>(V, <span class="keyword">...</span>
2462         <span class="keyword">...</span><span class="comment">guiparams.contour, ...</span>
2463         guiparams.horizontal_smoothing_window, <span class="keyword">...</span>
2464         guiparams.vertical_smoothing_window);
2465     
2466     <span class="comment">% Push messages to Log Window:</span>
2467     <span class="comment">% ----------------------------</span>
2468     statusLogging(handles.LogWindow, processing_log_text)
2469 
2470     
2471     <a href="VMT_MBBathy.html" class="code" title="function [A] = VMT_MBBathy(z,A,savefile,beamAng,magVar,wsedata,saveaux)">VMT_MBBathy</a>(guiparams.z, <span class="keyword">...</span>
2472         guiparams.A, <span class="keyword">...</span>
2473         savefile, <span class="keyword">...</span>
2474         guiparams.beam_angle, <span class="keyword">...</span>
2475         guiparams.magnetic_variation, <span class="keyword">...</span>
2476         guiparams.wse, <span class="keyword">...</span>
2477         guiparams.output_auxiliary_data);
2478     
2479     <span class="comment">%msgbox('Bathymetry Output Complete','VMT Status','help','replace')</span>
2480     
2481 <span class="keyword">end</span>
2482 
2483 <span class="comment">% [EOF] ExportMultibeamBathymetry_Callback</span>
2484 
2485 
2486 <span class="comment">% --------------------------------------------------------------------</span>
2487 <a name="_sub62" href="#_subfunctions" class="code">function BeamAngle_Callback(hObject, eventdata, handles)</a>
2488 <span class="comment">% Get the beam angle</span>
2489 
2490 <span class="comment">% Get the Application data:</span>
2491 <span class="comment">% -------------------------</span>
2492 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2493 
2494 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2495 <span class="comment">% ----------------------------------------------------------------</span>
2496 new_beam_angle = str2double(get(hObject,<span class="string">'String'</span>));
2497 is_a_number = ~isnan(new_beam_angle);
2498 is_positive = new_beam_angle&gt;=0;
2499 
2500 <span class="comment">% Modify the Application data:</span>
2501 <span class="comment">% ----------------------------</span>
2502 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2503     guiparams.beam_angle = new_beam_angle;
2504     
2505     <span class="comment">% Re-store the Application data:</span>
2506     <span class="comment">% ------------------------------</span>
2507     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2508     
2509 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2510     set(hObject,<span class="string">'String'</span>,guiparams.beam_angle)
2511 <span class="keyword">end</span>
2512 
2513 <span class="comment">% [EOF] BeamAngle_Callback</span>
2514 
2515 
2516 <span class="comment">% --------------------------------------------------------------------</span>
2517 <a name="_sub63" href="#_subfunctions" class="code">function MagneticVariation_Callback(hObject, eventdata, handles)</a>
2518 <span class="comment">% Get the Magnetic Variation</span>
2519 
2520 <span class="comment">% Get the Application data:</span>
2521 <span class="comment">% -------------------------</span>
2522 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2523 
2524 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2525 <span class="comment">% ----------------------------------------------------------------</span>
2526 new_magnetic_variation = str2double(get(hObject,<span class="string">'String'</span>));
2527 is_a_number = ~isnan(new_magnetic_variation);
2528 is_positive = new_magnetic_variation&gt;=0;
2529 
2530 <span class="comment">% Modify the Application data:</span>
2531 <span class="comment">% ----------------------------</span>
2532 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2533     guiparams.magnetic_variation = new_magnetic_variation;
2534     
2535     <span class="comment">% Re-store the Application data:</span>
2536     <span class="comment">% ------------------------------</span>
2537     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2538     
2539 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2540     set(hObject,<span class="string">'String'</span>,guiparams.magnetic_variation)
2541 <span class="keyword">end</span>
2542 
2543 <span class="comment">% [EOF] MagneticVariation_Callback</span>
2544 
2545 
2546 <span class="comment">% --------------------------------------------------------------------</span>
2547 <a name="_sub64" href="#_subfunctions" class="code">function WSE_Callback(hObject, eventdata, handles)</a>
2548 
2549 <span class="comment">% Get the Application data:</span>
2550 <span class="comment">% -------------------------</span>
2551 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2552 
2553 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2554 <span class="comment">% ----------------------------------------------------------------</span>
2555 new_wse = str2double(get(hObject,<span class="string">'String'</span>));
2556 is_a_number = ~isnan(new_wse);
2557 is_positive = new_wse&gt;=0;
2558 
2559 <span class="comment">% Modify the Application data:</span>
2560 <span class="comment">% ----------------------------</span>
2561 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2562     guiparams.wse = new_wse;
2563     
2564     <span class="comment">% Re-store the Application data:</span>
2565     <span class="comment">% ------------------------------</span>
2566     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2567     
2568 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2569     set(hObject,<span class="string">'String'</span>,guiparams.wse)
2570 <span class="keyword">end</span>
2571 
2572 <span class="comment">% [EOF] WSE_Callback</span>
2573 
2574 
2575 <span class="comment">% --------------------------------------------------------------------</span>
2576 <a name="_sub65" href="#_subfunctions" class="code">function OutputAuxiliaryData_Callback(hObject, eventdata, handles)</a>
2577 <span class="comment">% Bathymetry Auxiliary Data</span>
2578 
2579 <span class="comment">% Get the Application data:</span>
2580 <span class="comment">% -------------------------</span>
2581 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2582 
2583 <span class="comment">% Modify the Application data:</span>
2584 <span class="comment">% ----------------------------</span>
2585 guiparams.output_auxiliary_data = logical(get(hObject,<span class="string">'Value'</span>)); <span class="comment">% boolean</span>
2586 
2587 <span class="comment">% Re-store the Application data:</span>
2588 <span class="comment">% ------------------------------</span>
2589 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2590 
2591 <span class="comment">% [EOF] OutputAuxiliaryData_Callback</span>
2592 
2593 
2594 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2595 <span class="comment">% PLOTTING/PLAN VIEW PLOT CALLBACKS %</span>
2596 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2597 
2598 <span class="comment">% --------------------------------------------------------------------</span>
2599 <a name="_sub66" href="#_subfunctions" class="code">function DepthRangeMin_Callback(hObject, eventdata, handles)</a>
2600 
2601 <span class="comment">% Get the Application data:</span>
2602 <span class="comment">% -------------------------</span>
2603 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2604 
2605 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2606 <span class="comment">% ----------------------------------------------------------------</span>
2607 new_depth_range_min = str2double(get(hObject,<span class="string">'String'</span>));
2608 is_a_number = ~isnan(new_depth_range_min);
2609 is_positive = new_depth_range_min&gt;=0;
2610 
2611 <span class="comment">% Modify the Application data:</span>
2612 <span class="comment">% ----------------------------</span>
2613 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2614     guiparams.depth_range_min = new_depth_range_min;
2615     
2616     <span class="comment">% Re-store the Application data:</span>
2617     <span class="comment">% ------------------------------</span>
2618     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2619     
2620 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2621     set(hObject,<span class="string">'String'</span>,guiparams.depth_range_min)
2622 <span class="keyword">end</span>
2623 
2624 <span class="comment">% [EOF] DepthRangeMin_Callback</span>
2625 
2626 
2627 <span class="comment">% --------------------------------------------------------------------</span>
2628 <a name="_sub67" href="#_subfunctions" class="code">function DepthRangeMax_Callback(hObject, eventdata, handles)</a>
2629 
2630 <span class="comment">% Get the Application data:</span>
2631 <span class="comment">% -------------------------</span>
2632 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2633 
2634 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2635 <span class="comment">% ----------------------------------------------------------------</span>
2636 new_depth_range_max = str2double(get(hObject,<span class="string">'String'</span>));
2637 is_a_number = ~isnan(new_depth_range_max);
2638 is_positive = new_depth_range_max&gt;=0;
2639 
2640 <span class="comment">% Modify the Application data:</span>
2641 <span class="comment">% ----------------------------</span>
2642 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2643     guiparams.depth_range_max = new_depth_range_max;
2644     
2645     <span class="comment">% Re-store the Application data:</span>
2646     <span class="comment">% ------------------------------</span>
2647     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2648     
2649 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2650     set(hObject,<span class="string">'String'</span>,guiparams.depth_range_max)
2651 <span class="keyword">end</span>
2652 
2653 <span class="comment">% [EOF] DepthMax_Callback</span>
2654 
2655 
2656 <span class="comment">% --------------------------------------------------------------------</span>
2657 <a name="_sub68" href="#_subfunctions" class="code">function VectorScalePlanView_Callback(hObject, eventdata, handles)</a>
2658 <span class="comment">% Set quiver scale (contour)</span>
2659 
2660 <span class="comment">% Get the Application data:</span>
2661 <span class="comment">% -------------------------</span>
2662 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2663 
2664 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2665 <span class="comment">% ----------------------------------------------------------------</span>
2666 new_vector_scale_plan_view = str2double(get(hObject,<span class="string">'String'</span>));
2667 is_a_number = ~isnan(new_vector_scale_plan_view);
2668 is_positive = new_vector_scale_plan_view&gt;=0;
2669 
2670 <span class="comment">% Modify the Application data:</span>
2671 <span class="comment">% ----------------------------</span>
2672 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2673     guiparams.vector_scale_plan_view = round(new_vector_scale_plan_view);
2674     
2675     <span class="comment">% Re-store the Application data:</span>
2676     <span class="comment">% ------------------------------</span>
2677     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2678     
2679 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2680     set(hObject,<span class="string">'String'</span>,guiparams.vector_scale_plan_view)
2681 <span class="keyword">end</span>
2682 
2683 <span class="comment">% [EOF] VectorScalePlanView_Callback</span>
2684 
2685 
2686 <span class="comment">% --------------------------------------------------------------------</span>
2687 <a name="_sub69" href="#_subfunctions" class="code">function VectorSpacingPlanview_Callback(hObject, eventdata, handles)</a>
2688 <span class="comment">% Set quiver spacing (contour, horizontal)</span>
2689 
2690 <span class="comment">% Get the Application data:</span>
2691 <span class="comment">% -------------------------</span>
2692 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2693 
2694 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2695 <span class="comment">% ----------------------------------------------------------------</span>
2696 new_vector_spacing_plan_view = str2double(get(hObject,<span class="string">'String'</span>));
2697 is_a_number = ~isnan(new_vector_spacing_plan_view);
2698 is_positive = new_vector_spacing_plan_view&gt;=0;
2699 
2700 <span class="comment">% Modify the Application data:</span>
2701 <span class="comment">% ----------------------------</span>
2702 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2703     guiparams.vector_spacing_plan_view = round(new_vector_spacing_plan_view);
2704     
2705     <span class="comment">% Re-store the Application data:</span>
2706     <span class="comment">% ------------------------------</span>
2707     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2708     
2709 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2710     set(hObject,<span class="string">'String'</span>,guiparams.vector_spacing_plan_view)
2711 <span class="keyword">end</span>
2712 
2713 <span class="comment">% [EOF] VectorSpacingPlanview_Callback</span>
2714 
2715 
2716 <span class="comment">% --------------------------------------------------------------------</span>
2717 <a name="_sub70" href="#_subfunctions" class="code">function SmoothingWindowSize_Callback(hObject, eventdata, handles)</a>
2718 <span class="comment">% Plan View smoothing window size</span>
2719 
2720 <span class="comment">% Get the Application data:</span>
2721 <span class="comment">% -------------------------</span>
2722 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2723 
2724 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2725 <span class="comment">% ----------------------------------------------------------------</span>
2726 new_smoothing_window_size = str2double(get(hObject,<span class="string">'String'</span>));
2727 is_a_number = ~isnan(new_smoothing_window_size);
2728 is_positive = new_smoothing_window_size&gt;=0;
2729 
2730 <span class="comment">% Modify the Application data:</span>
2731 <span class="comment">% ----------------------------</span>
2732 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2733     guiparams.smoothing_window_size = round(new_smoothing_window_size);
2734     
2735     <span class="comment">% Re-store the Application data:</span>
2736     <span class="comment">% ------------------------------</span>
2737     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2738     
2739 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2740     set(hObject,<span class="string">'String'</span>,guiparams.smoothing_window_size)
2741 <span class="keyword">end</span>
2742 
2743 <span class="comment">% [EOF] SmoothingWindowSize_Callback</span>
2744 
2745 
2746 <span class="comment">% --------------------------------------------------------------------</span>
2747 <a name="_sub71" href="#_subfunctions" class="code">function DisplayShoreline_Callback(hObject, eventdata, handles)</a>
2748 
2749 <span class="comment">% Get the Application data:</span>
2750 <span class="comment">% -------------------------</span>
2751 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2752 
2753 <span class="comment">% Modify the Application data:</span>
2754 <span class="comment">% ----------------------------</span>
2755 guiparams.display_shoreline = logical(get(hObject,<span class="string">'Value'</span>)); <span class="comment">% boolean</span>
2756 
2757 <span class="comment">% Re-store the Application data:</span>
2758 <span class="comment">% ------------------------------</span>
2759 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2760 
2761 <span class="comment">% [EOF] DisplayShoreline_Callback</span>
2762 
2763 
2764 <span class="comment">% --------------------------------------------------------------------</span>
2765 <a name="_sub72" href="#_subfunctions" class="code">function AddBackground_Callback(hObject, eventdata, handles)</a>
2766 
2767 <span class="comment">% Get the Application data:</span>
2768 <span class="comment">% -------------------------</span>
2769 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2770 
2771 <span class="comment">% Modify the Application data:</span>
2772 <span class="comment">% ----------------------------</span>
2773 guiparams.add_background = logical(get(hObject,<span class="string">'Value'</span>)); <span class="comment">% boolean</span>
2774 
2775 <span class="comment">% Re-store the Application data:</span>
2776 <span class="comment">% ------------------------------</span>
2777 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2778 
2779 <span class="comment">% [EOF] AddBackground_Callback</span>
2780 
2781 
2782 <span class="comment">% --------------------------------------------------------------------</span>
2783 <a name="_sub73" href="#_subfunctions" class="code">function PlotPlanView_Callback(hObject, eventdata, handles)</a>
2784 <a href="#_sub56" class="code" title="subfunction planviewPlotCallback(hObject, eventdata, handles)">planviewPlotCallback</a>(hObject, eventdata, handles)
2785 <span class="comment">% [EOF] PlotPlanView_Callback</span>
2786 
2787 
2788 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2789 <span class="comment">% PLOTTING/SHIP TRACKS PLOT CALLBACKS %</span>
2790 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2791 
2792 <span class="comment">% --------------------------------------------------------------------</span>
2793 <a name="_sub74" href="#_subfunctions" class="code">function HorizontalGridNodeSpacing_Callback(hObject, eventdata, handles)</a>
2794 <span class="comment">% Set the horizontal grid node spacing</span>
2795 
2796 <span class="comment">% Get the Application data:</span>
2797 <span class="comment">% -------------------------</span>
2798 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2799 
2800 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2801 <span class="comment">% ----------------------------------------------------------------</span>
2802 new_horizontal_grid_node_spacing = str2double(get(hObject,<span class="string">'String'</span>));
2803 is_a_number = ~isnan(new_horizontal_grid_node_spacing);
2804 is_positive = new_horizontal_grid_node_spacing&gt;=0;
2805 
2806 <span class="comment">% Modify the Application data:</span>
2807 <span class="comment">% ----------------------------</span>
2808 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2809     guiparams.horizontal_grid_node_spacing = new_horizontal_grid_node_spacing;
2810     
2811     <span class="comment">% Re-store the Application data:</span>
2812     <span class="comment">% ------------------------------</span>
2813     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2814     
2815 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2816     set(hObject,<span class="string">'String'</span>,guiparams.horizontal_grid_node_spacing)
2817 <span class="keyword">end</span>
2818 
2819 <span class="comment">% [EOF] HorizontalGridNodeSpacing_Callback</span>
2820 
2821 <span class="comment">% --------------------------------------------------------------------</span>
2822 <a name="_sub75" href="#_subfunctions" class="code">function VerticalGridNodeSpacing_Callback(hObject, eventdata, handles)</a>
2823 <span class="comment">% Set the horizontal grid node spacing</span>
2824 
2825 <span class="comment">% Get the Application data:</span>
2826 <span class="comment">% -------------------------</span>
2827 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2828 
2829 <span class="comment">% Get the new entry and make sure it is valid (numeric, positive):</span>
2830 <span class="comment">% ----------------------------------------------------------------</span>
2831 new_vertical_grid_node_spacing = str2double(get(hObject,<span class="string">'String'</span>));
2832 is_a_number = ~isnan(new_vertical_grid_node_spacing);
2833 is_positive = new_vertical_grid_node_spacing&gt;=0;
2834 
2835 <span class="comment">% Modify the Application data:</span>
2836 <span class="comment">% ----------------------------</span>
2837 <span class="keyword">if</span> is_a_number &amp;&amp; is_positive
2838     guiparams.vertical_grid_node_spacing = new_vertical_grid_node_spacing;
2839     
2840     <span class="comment">% Re-store the Application data:</span>
2841     <span class="comment">% ------------------------------</span>
2842     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2843     
2844 <span class="keyword">else</span> <span class="comment">% Reject the (incorrect) input</span>
2845     set(hObject,<span class="string">'String'</span>,guiparams.vertical_grid_node_spacing)
2846 <span class="keyword">end</span>
2847 
2848 <span class="comment">% [EOF] VerticalGridNodeSpacing_Callback</span>
2849 
2850 <span class="comment">% --------------------------------------------------------------------</span>
2851 <a name="_sub76" href="#_subfunctions" class="code">function SetCrossSectionEndpoints_Callback(hObject, eventdata, handles)</a>
2852 <span class="comment">% Set the cross section endpoints manually</span>
2853 
2854 <span class="comment">% Get the Application data:</span>
2855 <span class="comment">% -------------------------</span>
2856 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2857 
2858 <span class="comment">% Modify the Application data:</span>
2859 <span class="comment">% ----------------------------</span>
2860 guiparams.set_cross_section_endpoints = logical(get(hObject,<span class="string">'Value'</span>)); <span class="comment">% boolean</span>
2861 
2862 <span class="comment">% Re-store the Application data:</span>
2863 <span class="comment">% ------------------------------</span>
2864 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2865 
2866 <span class="comment">% [EOF] SetCrossSectionEndpoints_Callback</span>
2867 
2868 
2869 <span class="comment">% --------------------------------------------------------------------</span>
2870 <a name="_sub77" href="#_subfunctions" class="code">function PlotShiptracks_Callback(hObject, eventdata, handles)</a>
2871 <a href="#_sub55" class="code" title="subfunction shiptracksPlotCallback(hObject, eventdata, handles)">shiptracksPlotCallback</a>(hObject, eventdata, handles)
2872 <span class="comment">% [EOF] PlotShiptracks_Callback</span>
2873 
2874 
2875 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2876 <span class="comment">% PLOTTING/CROSS SECTION PLOT CALLBACKS %</span>
2877 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
2878 
2879 <span class="comment">% --------------------------------------------------------------------</span>
2880 <a name="_sub78" href="#_subfunctions" class="code">function Contour_Callback(hObject, eventdata, handles)</a>
2881 
2882 <span class="comment">% Get the Application data:</span>
2883 <span class="comment">% -------------------------</span>
2884 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2885 
2886 <span class="comment">% Modify the Application data:</span>
2887 <span class="comment">% ----------------------------</span>
2888 idx_variable = get(hObject,<span class="string">'Value'</span>);
2889 guiparams.idx_contour = idx_variable;
2890 guiparams.contour = guiparams.contours(idx_variable).variable;
2891 
2892 <span class="comment">% Re-store the Application data:</span>
2893 <span class="comment">% ------------------------------</span>
2894 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2895 
2896 <span class="comment">% [EOF] Contour_Callback</span>
2897 
2898 
2899 <span class="comment">% --------------------------------------------------------------------</span>
2900 <a name="_sub79" href="#_subfunctions" class="code">function VerticalExaggeration_Callback(hObject, eventdata, handles)</a>
2901 <span class="comment">% Set vertical exaggeration</span>
2902 
2903 <span class="comment">% Get the Application data:</span>
2904 <span class="comment">% -------------------------</span>
2905 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2906 
2907 <span class="comment">% Modify the Application data:</span>
2908 <span class="comment">% ----------------------------</span>
2909 guiparams.vertical_exaggeration = str2double(get(hObject,<span class="string">'String'</span>));
2910 
2911 <span class="comment">% Re-store the Application data:</span>
2912 <span class="comment">% ------------------------------</span>
2913 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2914 
2915 <span class="comment">% Update the GUI:</span>
2916 <span class="comment">% ---------------</span>
2917 <span class="comment">% updateGUI(handles,guiparams)</span>
2918 
2919 <span class="comment">% [EOF] VerticalExaggeration_Callback</span>
2920 
2921 
2922 <span class="comment">% --------------------------------------------------------------------</span>
2923 <a name="_sub80" href="#_subfunctions" class="code">function VectorScaleCrossSection_Callback(hObject, eventdata, handles)</a>
2924 
2925 <span class="comment">% Get the Application data:</span>
2926 <span class="comment">% -------------------------</span>
2927 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2928 
2929 <span class="comment">% Modify the Application data:</span>
2930 <span class="comment">% ----------------------------</span>
2931 guiparams.vector_scale_cross_section = str2double(get(hObject,<span class="string">'String'</span>));
2932 
2933 <span class="comment">% Re-store the Application data:</span>
2934 <span class="comment">% ------------------------------</span>
2935 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2936 
2937 <span class="comment">% Update the GUI:</span>
2938 <span class="comment">% ---------------</span>
2939 <span class="comment">% updateGUI(handles,guiparams)</span>
2940 
2941 <span class="comment">% [EOF] VectorScaleCrossSection_Callback</span>
2942 
2943 
2944 <span class="comment">% --------------------------------------------------------------------</span>
2945 <a name="_sub81" href="#_subfunctions" class="code">function HorizontalVectorSpacing_Callback(hObject, eventdata, handles)</a>
2946 
2947 <span class="comment">% Get the Application data:</span>
2948 <span class="comment">% -------------------------</span>
2949 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2950 
2951 <span class="comment">% Modify the Application data:</span>
2952 <span class="comment">% ----------------------------</span>
2953 guiparams.horizontal_vector_spacing = str2double(get(hObject,<span class="string">'String'</span>));
2954 
2955 <span class="comment">% Re-store the Application data:</span>
2956 <span class="comment">% ------------------------------</span>
2957 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2958 
2959 <span class="comment">% Update the GUI:</span>
2960 <span class="comment">% ---------------</span>
2961 <span class="comment">% updateGUI(handles,guiparams)</span>
2962 
2963 <span class="comment">% [EOF] HorizontalVectorSpacing_Callback</span>
2964 
2965 
2966 <span class="comment">% --------------------------------------------------------------------</span>
2967 <a name="_sub82" href="#_subfunctions" class="code">function VerticalVectorSpacing_Callback(hObject, eventdata, handles)</a>
2968 <span class="comment">% Get the vertical quiver spacing for contour plots</span>
2969 
2970 <span class="comment">% Get the Application data:</span>
2971 <span class="comment">% -------------------------</span>
2972 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2973 
2974 <span class="comment">% Modify the Application data:</span>
2975 <span class="comment">% ----------------------------</span>
2976 guiparams.vertical_vector_spacing = str2double(get(hObject,<span class="string">'String'</span>));
2977 
2978 <span class="comment">% Re-store the Application data:</span>
2979 <span class="comment">% ------------------------------</span>
2980 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
2981 
2982 <span class="comment">% Update the GUI:</span>
2983 <span class="comment">% ---------------</span>
2984 <span class="comment">% updateGUI(handles,guiparams)</span>
2985 
2986 <span class="comment">% [EOF] VerticalVectorSpacing_Callback</span>
2987 
2988 
2989 <span class="comment">% --------------------------------------------------------------------</span>
2990 <a name="_sub83" href="#_subfunctions" class="code">function HorizontalSmoothingWindow_Callback(hObject, eventdata, handles)</a>
2991 <span class="comment">% Horizontal Smoothing</span>
2992 
2993 <span class="comment">% Get the Application data:</span>
2994 <span class="comment">% -------------------------</span>
2995 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
2996 
2997 <span class="comment">% Modify the Application data:</span>
2998 <span class="comment">% ----------------------------</span>
2999 guiparams.horizontal_smoothing_window = str2double(get(hObject,<span class="string">'String'</span>));
3000 
3001 <span class="comment">% Re-store the Application data:</span>
3002 <span class="comment">% ------------------------------</span>
3003 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
3004 
3005 <span class="comment">% Update the GUI:</span>
3006 <span class="comment">% ---------------</span>
3007 <span class="comment">% updateGUI(handles,guiparams)</span>
3008 
3009 <span class="comment">% [EOF] HorizontalSmoothingWindow_Callback</span>
3010 
3011 
3012 <span class="comment">% --------------------------------------------------------------------</span>
3013 <a name="_sub84" href="#_subfunctions" class="code">function VerticalSmoothingWindow_Callback(hObject, eventdata, handles)</a>
3014 <span class="comment">% Vertical Smoothing</span>
3015 
3016 <span class="comment">% Get the Application data:</span>
3017 <span class="comment">% -------------------------</span>
3018 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
3019 
3020 <span class="comment">% Modify the Application data:</span>
3021 <span class="comment">% ----------------------------</span>
3022 guiparams.vertical_smoothing_window = str2double(get(hObject,<span class="string">'String'</span>));
3023 
3024 <span class="comment">% Re-store the Application data:</span>
3025 <span class="comment">% ------------------------------</span>
3026 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
3027 
3028 <span class="comment">% Update the GUI:</span>
3029 <span class="comment">% ---------------</span>
3030 <span class="comment">% updateGUI(handles,guiparams)</span>
3031 
3032 <span class="comment">% [EOF] VerticalSmoothingWindow_Callback</span>
3033 
3034 
3035 <span class="comment">% --------------------------------------------------------------------</span>
3036 <a name="_sub85" href="#_subfunctions" class="code">function PlotSecondaryFlowVectors_Callback(hObject, eventdata, handles)</a>
3037 
3038 <span class="comment">% Get the Application data:</span>
3039 <span class="comment">% -------------------------</span>
3040 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
3041 
3042 <span class="comment">% Modify the Application data:</span>
3043 <span class="comment">% ----------------------------</span>
3044 guiparams.plot_secondary_flow_vectors = logical(get(hObject,<span class="string">'Value'</span>)); <span class="comment">% boolean</span>
3045 
3046 <span class="comment">% Re-store the Application data:</span>
3047 <span class="comment">% ------------------------------</span>
3048 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
3049 
3050 <span class="comment">% [EOF] PlotSecondaryFlowVectors_Callback</span>
3051 
3052 
3053 <span class="comment">% --------------------------------------------------------------------</span>
3054 <a name="_sub86" href="#_subfunctions" class="code">function SecondaryFlowVectorVariable_Callback(hObject, eventdata, handles)</a>
3055 
3056 <span class="comment">% Get the Application data:</span>
3057 <span class="comment">% -------------------------</span>
3058 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
3059 
3060 <span class="comment">% Modify the Application data:</span>
3061 <span class="comment">% ----------------------------</span>
3062 idx_variable = get(hObject,<span class="string">'Value'</span>);
3063 guiparams.idx_secondary_flow_vector_variable = idx_variable;
3064 guiparams.secondary_flow_vector_variable = guiparams.secondary_flows(idx_variable).variable;
3065 
3066 <span class="comment">% Re-store the Application data:</span>
3067 <span class="comment">% ------------------------------</span>
3068 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
3069 
3070 <span class="comment">% [EOF] SecondaryFlowVectorVariable_Callback</span>
3071 
3072 
3073 <span class="comment">% --------------------------------------------------------------------</span>
3074 <a name="_sub87" href="#_subfunctions" class="code">function IncludeVerticalVelocity_Callback(hObject, eventdata, handles)</a>
3075 
3076 <span class="comment">% Get the Application data:</span>
3077 <span class="comment">% -------------------------</span>
3078 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
3079 
3080 <span class="comment">% Modify the Application data:</span>
3081 <span class="comment">% ----------------------------</span>
3082 guiparams.include_vertical_velocity = logical(get(hObject,<span class="string">'Value'</span>)); <span class="comment">% boolean</span>
3083 
3084 <span class="comment">% Re-store the Application data:</span>
3085 <span class="comment">% ------------------------------</span>
3086 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
3087 
3088 <span class="comment">% [EOF] IncludeVerticalVelocity_Callback</span>
3089 
3090 
3091 <span class="comment">% --------------------------------------------------------------------</span>
3092 <a name="_sub88" href="#_subfunctions" class="code">function PlotCrossSection_Callback(hObject, eventdata, handles)</a>
3093 <a href="#_sub57" class="code" title="subfunction crosssectionPlotCallback(hObject, eventdata, handles)">crosssectionPlotCallback</a>(hObject, eventdata, handles)
3094 <span class="comment">% [EOF] PlotCrossSection_Callback</span>
3095 
3096 
3097 <span class="comment">% --------------------------------------------------------------------</span>
3098 <a name="_sub89" href="#_subfunctions" class="code">function ClearLog_Callback(hObject, eventdata, handles)</a>
3099 set(handles.LogWindow,<span class="string">'string'</span>,<span class="string">''</span>)
3100 <span class="comment">% [EOF] ClearLog_Callback</span>
3101 
3102 <span class="comment">% --------------------------------------------------------------------</span>
3103 <a name="_sub90" href="#_subfunctions" class="code">function SaveLog_Callback(hObject, eventdata, handles)</a>
3104 
3105 <span class="comment">% Get the Application data:</span>
3106 <span class="comment">% -------------------------</span>
3107 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
3108 guiprefs  = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
3109 <span class="comment">% z   = guiparams.z;   %#ok&lt;NASGU&gt;</span>
3110 <span class="comment">% A   = guiparams.A;   %#ok&lt;NASGU&gt;</span>
3111 <span class="comment">% V   = guiparams.V;   %#ok&lt;NASGU&gt;</span>
3112 <span class="comment">% Map = guiparams.Map; %#ok&lt;NASGU&gt;</span>
3113 
3114 [the_file,the_path] = <span class="keyword">...</span>
3115     uiputfile({<span class="string">'*.txt'</span>,<span class="string">'TXT-Files (*.txt)'</span>}, <span class="keyword">...</span>
3116     <span class="string">'Choose where to save the log file'</span>, <span class="keyword">...</span>
3117     fullfile(guiprefs.log_path,guiprefs.log_file));
3118 
3119 <span class="comment">% Save the log to a TXT file:</span>
3120 <span class="comment">% ---------------------------</span>
3121 <span class="keyword">if</span> ischar(the_file)
3122     guiparams.log_path = the_path;
3123     guiparams.log_file = the_file;
3124     <span class="comment">%guiparams.savefile = the_file;</span>
3125     
3126     <span class="comment">% Re-store the Application data:</span>
3127     <span class="comment">% ------------------------------</span>
3128     setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
3129     
3130     <span class="comment">% Update the preferences:</span>
3131     <span class="comment">% -----------------------</span>
3132     guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
3133     guiprefs.log_path = the_path;
3134     guiprefs.log_file = the_file;
3135     setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
3136     <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'log'</span>)
3137     
3138     [~,filename,extension] = fileparts(the_file);
3139     savefile = [the_path filename extension];
3140     h = msgbox([<span class="string">'Saving log to: '''</span> savefile <span class="string">''''</span>], <span class="keyword">...</span>
3141         <span class="string">'Saving Log File...'</span>); <span class="comment">%#ok&lt;NASGU&gt;</span>
3142     
3143     logfile = get(handles.LogWindow,<span class="string">'string'</span>);
3144     [nrows,~]= size(logfile);
3145     fid = fopen(savefile, <span class="string">'w'</span>);
3146     <span class="keyword">for</span> row=1:nrows
3147         fprintf(fid, <span class="string">'%s \n'</span>, logfile{row,:});
3148     <span class="keyword">end</span>
3149     fclose(fid);
3150 <span class="keyword">end</span>
3151 <span class="comment">% [EOF] SaveLog_Callback</span>
3152 
3153 <span class="comment">%%%%%%%%%%%%%%%%</span>
3154 <span class="comment">% SUBFUNCTIONS %</span>
3155 <span class="comment">%%%%%%%%%%%%%%%%</span>
3156 
3157 <span class="comment">% --------------------------------------------------------------------</span>
3158 <a name="_sub91" href="#_subfunctions" class="code">function handles = buildToolbar(handles)</a>
3159 
3160 icons = <a href="#_sub107" class="code" title="subfunction icons = getIcons">getIcons</a>;
3161 ht = uitoolbar(<span class="string">'Parent'</span>,handles.figure1);
3162 
3163 <span class="comment">% Load data</span>
3164 <span class="comment">% icon = imread('C:\Users\pfricker\Desktop\icons\file_open.png');</span>
3165 <span class="comment">% icon = double(icon)/(2^16-1);</span>
3166 <span class="comment">% icon(icon==0) = NaN;</span>
3167 handles.toolbarLoadData = <span class="keyword">...</span>
3168     uipushtool(<span class="string">'Parent'</span>,       ht, <span class="keyword">...</span>
3169     <span class="string">'CData'</span>,        icons(1).data, <span class="keyword">...</span>
3170     <span class="string">'TooltipString'</span>,<span class="string">'Open ASCII File'</span>);
3171 
3172 <span class="comment">% Save data</span>
3173 <span class="comment">% icon = imread('C:\Users\pfricker\Desktop\icons\file_save.png');</span>
3174 <span class="comment">% icon = double(icon)/(2^16-1);</span>
3175 <span class="comment">% icon(icon==0) = NaN;</span>
3176 handles.toolbarSaveMatFile = <span class="keyword">...</span>
3177     uipushtool(<span class="string">'Parent'</span>,       ht, <span class="keyword">...</span>
3178     <span class="string">'CData'</span>,        icons(2).data, <span class="keyword">...</span>
3179     <span class="string">'TooltipString'</span>,<span class="string">'Save MAT File'</span>, <span class="keyword">...</span>
3180     <span class="string">'Separator'</span>,    <span class="string">'on'</span>);
3181 
3182 
3183 <span class="comment">% Save bathymetry</span>
3184 <span class="comment">%icon = ones(16,16,3);</span>
3185 handles.toolbarSaveBathymetry = <span class="keyword">...</span>
3186     uipushtool(<span class="string">'Parent'</span>,       ht, <span class="keyword">...</span>
3187     <span class="string">'CData'</span>,        icons(5).data, <span class="keyword">...</span>
3188     <span class="string">'TooltipString'</span>,<span class="string">'Export Bathymetry'</span>);
3189 
3190 <span class="comment">% Save figures</span>
3191 <span class="comment">% icon = ones(16,16,3);</span>
3192 handles.toolbarSaveFigures = <span class="keyword">...</span>
3193     uipushtool(<span class="string">'Parent'</span>,       ht, <span class="keyword">...</span>
3194     <span class="string">'CData'</span>,        icons(6).data, <span class="keyword">...</span>
3195     <span class="string">'TooltipString'</span>,<span class="string">'Export Figures'</span>);
3196 
3197 <span class="comment">% Save Excel File</span>
3198 <span class="comment">% icon = ones(16,16,3);</span>
3199 handles.toolbarSaveExcel = <span class="keyword">...</span>
3200     uipushtool(<span class="string">'Parent'</span>,       ht, <span class="keyword">...</span>
3201     <span class="string">'CData'</span>,        icons(7).data, <span class="keyword">...</span>
3202     <span class="string">'TooltipString'</span>,<span class="string">'Export Excel File'</span>);
3203 
3204 
3205 <span class="comment">% Plotting parameters</span>
3206 <span class="comment">% [icon,map] = imread('C:\Users\pfricker\Desktop\icons\PlotGeneralElement.gif');</span>
3207 <span class="comment">% icon = ind2rgb(icon,map);</span>
3208 handles.toolbarPlottingParameters = <span class="keyword">...</span>
3209     uipushtool(<span class="string">'Parent'</span>,       ht, <span class="keyword">...</span>
3210     <span class="string">'CData'</span>,        icons(3).data, <span class="keyword">...</span>
3211     <span class="string">'TooltipString'</span>,<span class="string">'Plotting Parameters'</span>, <span class="keyword">...</span>
3212     <span class="string">'Separator'</span>,    <span class="string">'on'</span>);
3213 
3214 <span class="comment">% Processing parameters</span>
3215 <span class="comment">% [icon,map] = imread('C:\Users\pfricker\Desktop\icons\ParameterIcon.gif');</span>
3216 <span class="comment">% icon = ind2rgb(icon,map);</span>
3217 handles.toolbarProcessingParameters = <span class="keyword">...</span>
3218     uipushtool(<span class="string">'Parent'</span>,       ht, <span class="keyword">...</span>
3219     <span class="string">'CData'</span>,        icons(4).data, <span class="keyword">...</span>
3220     <span class="string">'TooltipString'</span>,<span class="string">'Processing Parameters'</span>);
3221 
3222 <span class="comment">% Zoom In</span>
3223 <span class="comment">% [icon,map] = imread('C:\Users\pfricker\Desktop\icons\ParameterIcon.gif');</span>
3224 <span class="comment">% icon = ind2rgb(icon,map);</span>
3225 <span class="comment">% handles.toolbarZoomIn = ...</span>
3226 <span class="comment">%     uitoggletool('Parent',       ht, ...</span>
3227 <span class="comment">%     'CData',        icons(8).data, ...</span>
3228 <span class="comment">%     'TooltipString','Zoom In (Shiptracks)', ...</span>
3229 <span class="comment">%     'Separator',     'on');</span>
3230 
3231 <span class="comment">% Zoom Out</span>
3232 <span class="comment">% [icon,map] = imread('C:\Users\pfricker\Desktop\icons\ParameterIcon.gif');</span>
3233 <span class="comment">% icon = ind2rgb(icon,map);</span>
3234 <span class="comment">% handles.toolbarZoomOut = ...</span>
3235 <span class="comment">%     uitoggletool('Parent',       ht, ...</span>
3236 <span class="comment">%     'CData',        icons(9).data, ...</span>
3237 <span class="comment">%     'TooltipString','Zoom Out (Shiptracks)');</span>
3238 
3239 <span class="comment">% Pan</span>
3240 <span class="comment">% [icon,map] = imread('C:\Users\pfricker\Desktop\icons\ParameterIcon.gif');</span>
3241 <span class="comment">% icon = ind2rgb(icon,map);</span>
3242 <span class="comment">% handles.toolbarPan = ...</span>
3243 <span class="comment">%     uipushtool('Parent',       ht, ...</span>
3244 <span class="comment">%     'CData',        icons(10).data, ...</span>
3245 <span class="comment">%     'TooltipString','Pan (Shiptracks)');</span>
3246 
3247 
3248 
3249 set(handles.toolbarLoadData,            <span class="string">'ClickedCallback'</span>,{@<a href="#_sub50" class="code" title="subfunction loadDataCallback(hObject, eventdata, handles)">loadDataCallback</a>,handles})
3250 set(handles.toolbarSaveMatFile,         <span class="string">'ClickedCallback'</span>,{@<a href="#_sub51" class="code" title="subfunction saveDataCallback(hObject, eventdata, handles)">saveDataCallback</a>,handles})
3251 set(handles.toolbarSaveBathymetry,      <span class="string">'ClickedCallback'</span>,{@<a href="#_sub61" class="code" title="subfunction ExportMultibeamBathymetry_Callback(hObject, eventdata, handles)">ExportMultibeamBathymetry_Callback</a>,handles})
3252 set(handles.toolbarSaveFigures,         <span class="string">'ClickedCallback'</span>,{@<a href="#_sub21" class="code" title="subfunction menuExportFigures_Callback(hObject, eventdata, handles)">menuExportFigures_Callback</a>,handles})
3253 set(handles.toolbarSaveExcel,           <span class="string">'ClickedCallback'</span>,{@<a href="#_sub25" class="code" title="subfunction menuSaveExcel_Callback(hObject, eventdata, handles)">menuSaveExcel_Callback</a>,handles})
3254 set(handles.toolbarPlottingParameters,  <span class="string">'ClickedCallback'</span>,{@<a href="#_sub53" class="code" title="subfunction plottingParametersCallback(hObject, eventdata, handles)">plottingParametersCallback</a>,handles})
3255 set(handles.toolbarProcessingParameters,<span class="string">'ClickedCallback'</span>,{@<a href="#_sub54" class="code" title="subfunction processingParametersCallback(hObject, eventdata, handles)">processingParametersCallback</a>,handles})
3256 <span class="comment">% set(handles.toolbarZoomIn,              'ClickedCallback',{@ShiptracksZoom_Callback,handles})</span>
3257 <span class="comment">% set(handles.toolbarZoomOut,              'ClickedCallback',{@ShiptracksZoom_Callback,handles})</span>
3258 <span class="comment">% set(handles.toolbarPan,              'ClickedCallback',{@ShiptracksPan_Callback,handles})</span>
3259 <span class="comment">% set(handles.planviewPlot,        'ClickedCallback',{@planviewPlotCallback,handles})</span>
3260 <span class="comment">% set(handles.crosssectionPlot,    'ClickedCallback',{@crosssectionPlotCallback,handles})</span>
3261 
3262 <span class="comment">% [EOF] buildtoolbar</span>
3263 
3264 
3265 <span class="comment">% --------------------------------------------------------------------</span>
3266 <a name="_sub92" href="#_subfunctions" class="code">function load_prefs(hfigure)</a>
3267 <span class="comment">% Load the GUI preferences.  Also, initialize preferences if they don't</span>
3268 <span class="comment">% already exist.</span>
3269 
3270 <span class="comment">% Preferences:</span>
3271 <span class="comment">% 'ascii'                Path and filenames of current ASCII files</span>
3272 <span class="comment">% 'mat'                  Path and filename of current MAT file</span>
3273 <span class="comment">% 'tecplot'              Path and filename of last Tecplot file</span>
3274 <span class="comment">% 'kmz'                  Path and filename of last KMZ file</span>
3275 <span class="comment">% 'multibeambathymetry'  Path and filename of last Multibeam Bathymetry file</span>
3276 <span class="comment">% 'log'                  Path and filename of last Log file</span>
3277 <span class="comment">% 'iric'                 Path and filename of last iRic ANV file</span>
3278 <span class="comment">% 'excel'                Path and filename of last Excel file</span>
3279 <span class="comment">% 'aerial'               Path and filename of last Aerial file</span>
3280 <span class="comment">% 'shoreline'            Path and filename of last Shoreline file</span>
3281 <span class="comment">% 'renderer'             Default graphics renderer</span>
3282 <span class="comment">% 'units'                Default plotting units</span>
3283 
3284 <span class="comment">% Originals</span>
3285 <span class="comment">% prefs = {'ascii2gispath' 'ascii2kmlpath' 'asciipath'   'doqqpath' ...</span>
3286 <span class="comment">%          'endspath'      'logpath'       'matpath'     'savedpath' ...</span>
3287 <span class="comment">%          'shorepath'     'stapath'       'ysidatapath' 'ysidatapath'};</span>
3288 
3289 <span class="comment">% ASCII</span>
3290 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'ascii'</span>)
3291     ascii = getpref(<span class="string">'VMT'</span>,<span class="string">'ascii'</span>);
3292     <span class="keyword">if</span> exist(ascii.path,<span class="string">'dir'</span>)
3293         guiprefs.ascii_path = ascii.path;
3294     <span class="keyword">else</span>
3295         guiprefs.ascii_path = pwd;
3296     <span class="keyword">end</span>
3297     does_exist = false(1,length(ascii.file));
3298     <span class="keyword">for</span> k = 1:length(ascii.file) <span class="comment">% Check each file one-by-one</span>
3299         does_exist(k) = exist(fullfile(ascii.path,ascii.file{k}),<span class="string">'file'</span>);
3300     <span class="keyword">end</span>
3301     <span class="keyword">if</span> any(does_exist)
3302         guiprefs.ascii_file = ascii.file(does_exist);
3303     <span class="keyword">else</span>
3304         guiprefs.ascii_file = {<span class="string">''</span>};
3305     <span class="keyword">end</span>
3306 <span class="keyword">else</span> <span class="comment">% Initialize ASCII</span>
3307     guiprefs.ascii_path = pwd;
3308     guiprefs.ascii_file = {<span class="string">''</span>};
3309     
3310     ascii.path = pwd;
3311     ascii.file = {<span class="string">''</span>};
3312     setpref(<span class="string">'VMT'</span>,<span class="string">'ascii'</span>,ascii)
3313 <span class="keyword">end</span>
3314 
3315 <span class="comment">% MAT</span>
3316 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'mat'</span>)
3317     mat = getpref(<span class="string">'VMT'</span>,<span class="string">'mat'</span>);
3318     <span class="keyword">if</span> exist(mat.path,<span class="string">'dir'</span>)
3319         guiprefs.mat_path = mat.path;
3320     <span class="keyword">else</span>
3321         guiprefs.mat_path = pwd;
3322     <span class="keyword">end</span>
3323     
3324     <span class="keyword">if</span> iscell(mat.file)
3325         <span class="keyword">if</span> exist(fullfile(mat.path,mat.file{1}),<span class="string">'file'</span>)
3326             guiprefs.mat_file = mat.file;
3327         <span class="keyword">else</span>
3328             guiprefs.mat_file = <span class="string">''</span>;
3329         <span class="keyword">end</span>
3330     <span class="keyword">else</span>
3331         <span class="keyword">if</span> exist(fullfile(mat.path,mat.file),<span class="string">'file'</span>)
3332             guiprefs.mat_file = mat.file;
3333         <span class="keyword">else</span>
3334             guiprefs.mat_file = <span class="string">''</span>;
3335         <span class="keyword">end</span>
3336     <span class="keyword">end</span>
3337 <span class="keyword">else</span> <span class="comment">% Initialize MAT</span>
3338     guiprefs.mat_path = pwd;
3339     guiprefs.mat_file = <span class="string">''</span>;
3340     
3341     mat.path = pwd;
3342     mat.file = <span class="string">''</span>;
3343     setpref(<span class="string">'VMT'</span>,<span class="string">'mat'</span>,mat)
3344 <span class="keyword">end</span>
3345 
3346 <span class="comment">% TECPLOT</span>
3347 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'tecplot'</span>)
3348     tecplot = getpref(<span class="string">'VMT'</span>,<span class="string">'tecplot'</span>);
3349     <span class="keyword">if</span> exist(tecplot.path,<span class="string">'dir'</span>)
3350         guiprefs.tecplot_path = tecplot.path;
3351     <span class="keyword">else</span>
3352         guiprefs.tecplot_path = pwd;
3353     <span class="keyword">end</span>
3354     <span class="keyword">if</span> exist(fullfile(tecplot.path,tecplot.file),<span class="string">'file'</span>)
3355         guiprefs.tecplot_file = tecplot.file;
3356     <span class="keyword">else</span>
3357         guiprefs.tecplot_file = <span class="string">''</span>;
3358     <span class="keyword">end</span>
3359 <span class="keyword">else</span> <span class="comment">% Initialize TECPLOT</span>
3360     guiprefs.tecplot_path = pwd;
3361     guiprefs.tecplot_file = <span class="string">''</span>;
3362     
3363     tecplot.path = pwd;
3364     tecplot.file = <span class="string">''</span>;
3365     setpref(<span class="string">'VMT'</span>,<span class="string">'tecplot'</span>,tecplot)
3366 <span class="keyword">end</span>
3367 
3368 <span class="comment">% KMZ</span>
3369 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'kmz'</span>)
3370     kmz = getpref(<span class="string">'VMT'</span>,<span class="string">'kmz'</span>);
3371     <span class="keyword">if</span> exist(kmz.path,<span class="string">'dir'</span>)
3372         guiprefs.kmz_path = kmz.path;
3373     <span class="keyword">else</span>
3374         guiprefs.kmz_path = pwd;
3375     <span class="keyword">end</span>
3376     <span class="keyword">if</span> exist(fullfile(kmz.path,kmz.file),<span class="string">'file'</span>)
3377         guiprefs.kmz_file = kmz.file;
3378     <span class="keyword">else</span>
3379         guiprefs.kmz_file = <span class="string">''</span>;
3380     <span class="keyword">end</span>
3381 <span class="keyword">else</span> <span class="comment">% Initialize KMZ</span>
3382     guiprefs.kmz_path = pwd;
3383     guiprefs.kmz_file = <span class="string">''</span>;
3384     
3385     kmz.path = pwd;
3386     kmz.file = <span class="string">''</span>;
3387     setpref(<span class="string">'VMT'</span>,<span class="string">'kmz'</span>,kmz)
3388 <span class="keyword">end</span>
3389 
3390 <span class="comment">% MULTIBEAM BATHYMETRY</span>
3391 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'multibeambathymetry'</span>)
3392     multibeambathymetry = getpref(<span class="string">'VMT'</span>,<span class="string">'multibeambathymetry'</span>);
3393     <span class="keyword">if</span> exist(multibeambathymetry.path,<span class="string">'dir'</span>)
3394         guiprefs.multibeambathymetry_path = multibeambathymetry.path;
3395     <span class="keyword">else</span>
3396         guiprefs.multibeambathymetry_path = pwd;
3397     <span class="keyword">end</span>
3398     <span class="keyword">if</span> exist(fullfile(multibeambathymetry.path,multibeambathymetry.file),<span class="string">'file'</span>)
3399         guiprefs.multibeambathymetry_file = multibeambathymetry.file;
3400     <span class="keyword">else</span>
3401         guiprefs.multibeambathymetry_file = <span class="string">''</span>;
3402     <span class="keyword">end</span>
3403 <span class="keyword">else</span> <span class="comment">% Initialize MULTIBEAM BATHYMETRY</span>
3404     guiprefs.multibeambathymetry_path = pwd;
3405     guiprefs.multibeambathymetry_file = <span class="string">''</span>;
3406     
3407     multibeambathymetry.path = pwd;
3408     multibeambathymetry.file = <span class="string">''</span>;
3409     setpref(<span class="string">'VMT'</span>,<span class="string">'multibeambathymetry'</span>,multibeambathymetry)
3410 <span class="keyword">end</span>
3411 
3412 <span class="comment">% Log</span>
3413 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'log'</span>)
3414     log = getpref(<span class="string">'VMT'</span>,<span class="string">'log'</span>);
3415     <span class="keyword">if</span> exist(log.path,<span class="string">'dir'</span>)
3416         guiprefs.log_path = log.path;
3417     <span class="keyword">else</span>
3418         guiprefs.log_path = pwd;
3419     <span class="keyword">end</span>
3420     <span class="keyword">if</span> exist(fullfile(log.path,log.file),<span class="string">'file'</span>)
3421         guiprefs.log_file = log.file;
3422     <span class="keyword">else</span>
3423         guiprefs.log_file = <span class="string">''</span>;
3424     <span class="keyword">end</span>
3425 <span class="keyword">else</span> <span class="comment">% Initialize Log</span>
3426     guiprefs.log_path = pwd;
3427     guiprefs.log_file = <span class="string">''</span>;
3428     
3429     log.path = pwd;
3430     log.file = <span class="string">''</span>;
3431     setpref(<span class="string">'VMT'</span>,<span class="string">'log'</span>,log)
3432 <span class="keyword">end</span>
3433 
3434 <span class="comment">% iRic</span>
3435 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'iric'</span>)
3436     iric = getpref(<span class="string">'VMT'</span>,<span class="string">'iric'</span>);
3437     <span class="keyword">if</span> exist(iric.path,<span class="string">'dir'</span>)
3438         guiprefs.iric_path = iric.path;
3439     <span class="keyword">else</span>
3440         guiprefs.iric_path = pwd;
3441     <span class="keyword">end</span>
3442     <span class="keyword">if</span> exist(fullfile(iric.path,iric.file),<span class="string">'file'</span>)
3443         guiprefs.iric_file = iric.file;
3444     <span class="keyword">else</span>
3445         guiprefs.iric_file = <span class="string">''</span>;
3446     <span class="keyword">end</span>
3447 <span class="keyword">else</span> <span class="comment">% Initialize Log</span>
3448     guiprefs.iric_path = pwd;
3449     guiprefs.iric_file = <span class="string">''</span>;
3450     
3451     iric.path = pwd;
3452     iric.file = <span class="string">''</span>;
3453     setpref(<span class="string">'VMT'</span>,<span class="string">'iric'</span>,iric)
3454 <span class="keyword">end</span>
3455 
3456 <span class="comment">% excel</span>
3457 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'excel'</span>)
3458     excel = getpref(<span class="string">'VMT'</span>,<span class="string">'excel'</span>);
3459     <span class="keyword">if</span> exist(excel.path,<span class="string">'dir'</span>)
3460         guiprefs.excel_path = excel.path;
3461     <span class="keyword">else</span>
3462         guiprefs.excel_path = pwd;
3463     <span class="keyword">end</span>
3464     <span class="keyword">if</span> exist(fullfile(excel.path,excel.file),<span class="string">'file'</span>)
3465         guiprefs.excel_file = excel.file;
3466     <span class="keyword">else</span>
3467         guiprefs.excel_file = <span class="string">''</span>;
3468     <span class="keyword">end</span>
3469 <span class="keyword">else</span> <span class="comment">% Initialize pref</span>
3470     guiprefs.excel_path = pwd;
3471     guiprefs.excel_file = <span class="string">''</span>;
3472     
3473     excel.path = pwd;
3474     excel.file = <span class="string">''</span>;
3475     setpref(<span class="string">'VMT'</span>,<span class="string">'excel'</span>,excel)
3476 <span class="keyword">end</span>
3477 
3478 <span class="comment">% aerial</span>
3479 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'aerial'</span>)
3480     aerial = getpref(<span class="string">'VMT'</span>,<span class="string">'aerial'</span>);
3481     <span class="keyword">if</span> exist(aerial.path,<span class="string">'dir'</span>)
3482         guiprefs.aerial_path = aerial.path;
3483     <span class="keyword">else</span>
3484         guiprefs.aerial_path = pwd;
3485     <span class="keyword">end</span>
3486     does_exist = false(1,length(aerial.file));
3487     <span class="keyword">if</span> iscell(aerial.file)
3488     <span class="keyword">for</span> k = 1:numel(aerial.file) <span class="comment">% Check each file one-by-one</span>
3489         does_exist(k) = exist(fullfile(aerial.path,aerial.file{k}),<span class="string">'file'</span>);
3490     <span class="keyword">end</span>
3491     <span class="keyword">else</span>
3492         does_exist = exist(fullfile(aerial.path,aerial.file),<span class="string">'file'</span>);
3493     <span class="keyword">end</span>
3494     <span class="keyword">if</span> any(does_exist)
3495         guiprefs.aerial_file = aerial.file;
3496     <span class="keyword">else</span>
3497         guiprefs.aerial_file = {<span class="string">''</span>};
3498     <span class="keyword">end</span>
3499 <span class="keyword">else</span> <span class="comment">% Initialize aerial</span>
3500     guiprefs.aerial_path = pwd;
3501     guiprefs.aerial_file = {<span class="string">''</span>};
3502     
3503     aerial.path = pwd;
3504     aerial.file = {<span class="string">''</span>};
3505     setpref(<span class="string">'VMT'</span>,<span class="string">'aerial'</span>,aerial)
3506 <span class="keyword">end</span>
3507 
3508 <span class="comment">% shoreline</span>
3509 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'shoreline'</span>)
3510     shoreline = getpref(<span class="string">'VMT'</span>,<span class="string">'shoreline'</span>);
3511     <span class="keyword">if</span> exist(shoreline.path,<span class="string">'dir'</span>)
3512         guiprefs.shoreline_path = shoreline.path;
3513     <span class="keyword">else</span>
3514         guiprefs.shoreline_path = pwd;
3515     <span class="keyword">end</span>
3516     
3517     <span class="keyword">if</span> iscell(shoreline.file)
3518         <span class="keyword">if</span> exist(fullfile(shoreline.path,shoreline.file{1}),<span class="string">'file'</span>)
3519             guiprefs.shoreline_file = shoreline.file;
3520         <span class="keyword">else</span>
3521             guiprefs.shoreline_file = <span class="string">''</span>;
3522         <span class="keyword">end</span>
3523     <span class="keyword">else</span>
3524         <span class="keyword">if</span> exist(fullfile(shoreline.path,shoreline.file),<span class="string">'file'</span>)
3525             guiprefs.shoreline_file = shoreline.file;
3526         <span class="keyword">else</span>
3527             guiprefs.shoreline_file = <span class="string">''</span>;
3528         <span class="keyword">end</span>
3529     <span class="keyword">end</span>
3530 <span class="keyword">else</span> <span class="comment">% Initialize shoreline</span>
3531     guiprefs.shoreline_path = pwd;
3532     guiprefs.shoreline_file = <span class="string">''</span>;
3533     
3534     shoreline.path = pwd;
3535     shoreline.file = <span class="string">''</span>;
3536     setpref(<span class="string">'VMT'</span>,<span class="string">'shoreline'</span>,shoreline)
3537 <span class="keyword">end</span>
3538 <span class="comment">% guiprefs.presentation = true;</span>
3539 <span class="comment">% guiprefs.print        = false;</span>
3540 
3541 <span class="comment">% for k = 1:length(prefs)</span>
3542 <span class="comment">%     newpref = '';</span>
3543 <span class="comment">%     if ispref('VMT',prefs{k})</span>
3544 <span class="comment">%         stored_newpref = getpref('VMT',prefs{k});</span>
3545 <span class="comment">%         if exist(stored_newpref,'dir')</span>
3546 <span class="comment">%             newpref = stored_newpref;</span>
3547 <span class="comment">%         else</span>
3548 <span class="comment">%             setpref('VMT',prefs{k},newpref)</span>
3549 <span class="comment">%         end</span>
3550 <span class="comment">%     end</span>
3551 <span class="comment">%     guiprefs.(prefs{k}) = newpref;</span>
3552 <span class="comment">% end</span>
3553 
3554 <span class="comment">% RENDERER</span>
3555 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'renderer'</span>)
3556     renderer = getpref(<span class="string">'VMT'</span>,<span class="string">'renderer'</span>);
3557     guiprefs.renderer = renderer;
3558 <span class="keyword">else</span> <span class="comment">% Initialize RENDERER</span>
3559     renderer           = <span class="string">'OpenGL'</span>;
3560     guiprefs.renderer  = renderer;
3561     setpref(<span class="string">'VMT'</span>,<span class="string">'renderer'</span>,renderer)
3562 <span class="keyword">end</span>
3563 
3564 <span class="comment">% UNITS</span>
3565 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'units'</span>)
3566     units = getpref(<span class="string">'VMT'</span>,<span class="string">'units'</span>);
3567     guiprefs.units = units;
3568 <span class="keyword">else</span> <span class="comment">% Initialize RENDERER</span>
3569     units           = <span class="string">'metric'</span>;
3570     guiprefs.units  = renderer;
3571     setpref(<span class="string">'VMT'</span>,<span class="string">'units'</span>,units)
3572 <span class="keyword">end</span>
3573 
3574 setappdata(hfigure,<span class="string">'guiprefs'</span>,guiprefs)
3575 
3576 <span class="comment">% [EOF] load_prefs</span>
3577 
3578 
3579 <span class="comment">% --------------------------------------------------------------------</span>
3580 <a name="_sub93" href="#_subfunctions" class="code">function store_prefs(hfigure,pref)</a>
3581 <span class="comment">% Store preferences in the Application data and in the persistent</span>
3582 <span class="comment">% preferences data.</span>
3583 
3584 <span class="comment">% Preferences:</span>
3585 <span class="comment">% 'ascii'                Path and filenames of current ASCII files</span>
3586 <span class="comment">% 'mat'                  Path and filename of current MAT file</span>
3587 <span class="comment">% 'tecplot'              Path and filename of last Tecplot file</span>
3588 <span class="comment">% 'kmz'                  Path and filename of last KMZ file</span>
3589 <span class="comment">% 'multibeambathymetry'  Path and filename of last Multibeam Bathymetry file</span>
3590 <span class="comment">% 'log'                  Path and filename of last Log file</span>
3591 <span class="comment">% 'iric'                 Path and filename of last iRic ANV file</span>
3592 <span class="comment">% 'excel'                Path and filename of last Excel file</span>
3593 <span class="comment">% 'aerial'               Path and filename of last Aerial file</span>
3594 <span class="comment">% 'shoreline'            Path and filename of last Shoreline file</span>
3595 <span class="comment">% 'renderer'             Default graphics renderer</span>
3596 <span class="comment">% 'units'                Default plotting units</span>
3597 
3598 guiprefs = getappdata(hfigure,<span class="string">'guiprefs'</span>);
3599 
3600 <span class="keyword">switch</span> pref
3601     <span class="keyword">case</span> <span class="string">'ascii'</span>
3602         ascii.path = guiprefs.ascii_path;
3603         ascii.file = guiprefs.ascii_file;
3604         setpref(<span class="string">'VMT'</span>,<span class="string">'ascii'</span>,ascii)
3605     <span class="keyword">case</span> <span class="string">'mat'</span>
3606         mat.path = guiprefs.mat_path;
3607         mat.file = guiprefs.mat_file;
3608         setpref(<span class="string">'VMT'</span>,<span class="string">'mat'</span>,mat)
3609     <span class="keyword">case</span> <span class="string">'tecplot'</span>
3610         tecplot.path = guiprefs.tecplot_path;
3611         tecplot.file = guiprefs.tecplot_file;
3612         setpref(<span class="string">'VMT'</span>,<span class="string">'tecplot'</span>,tecplot)
3613     <span class="keyword">case</span> <span class="string">'kmz'</span>
3614         kmz.path = guiprefs.kmz_path;
3615         kmz.file = guiprefs.kmz_file;
3616         setpref(<span class="string">'VMT'</span>,<span class="string">'kmz'</span>,kmz)
3617     <span class="keyword">case</span> <span class="string">'multibeambathymetry'</span>
3618         multibeambathymetry.path = guiprefs.multibeambathymetry_path;
3619         multibeambathymetry.file = guiprefs.multibeambathymetry_file;
3620         setpref(<span class="string">'VMT'</span>,<span class="string">'multibeambathymetry'</span>,multibeambathymetry)
3621     <span class="keyword">case</span> <span class="string">'log'</span>
3622         log.path = guiprefs.log_path;
3623         log.file = guiprefs.log_file;
3624         setpref(<span class="string">'VMT'</span>,<span class="string">'log'</span>,log)
3625     <span class="keyword">case</span> <span class="string">'iric'</span>
3626         iric.path = guiprefs.iric_path;
3627         iric.file = guiprefs.iric_file;
3628         setpref(<span class="string">'VMT'</span>,<span class="string">'iric'</span>,iric)
3629     <span class="keyword">case</span> <span class="string">'excel'</span>
3630         excel.path = guiprefs.excel_path;
3631         excel.file = guiprefs.excel_file;
3632         setpref(<span class="string">'VMT'</span>,<span class="string">'excel'</span>,excel)
3633     <span class="keyword">case</span> <span class="string">'aerial'</span>
3634         aerial.path = guiprefs.aerial_path;
3635         aerial.file = guiprefs.aerial_file;
3636         setpref(<span class="string">'VMT'</span>,<span class="string">'aerial'</span>,aerial)
3637     <span class="keyword">case</span> <span class="string">'shoreline'</span>
3638         shoreline.path = guiprefs.shoreline_path;
3639         shoreline.file = guiprefs.shoreline_file;
3640         setpref(<span class="string">'VMT'</span>,<span class="string">'shoreline'</span>,shoreline)
3641     <span class="keyword">case</span> <span class="string">'renderer'</span>
3642         renderer = guiprefs.renderer;
3643         setpref(<span class="string">'VMT'</span>,<span class="string">'renderer'</span>,renderer)
3644     <span class="keyword">case</span> <span class="string">'units'</span>
3645         units = guiprefs.units;
3646         setpref(<span class="string">'VMT'</span>,<span class="string">'units'</span>,units)
3647     <span class="keyword">otherwise</span>
3648 <span class="keyword">end</span>
3649 
3650 <span class="comment">% if ismember(pref,prefs)</span>
3651 <span class="comment">%     setpref('VMT',pref,value)</span>
3652 <span class="comment">%</span>
3653 <span class="comment">%     guiprefs = getappdata(hfigure,'guiprefs');</span>
3654 <span class="comment">%     guiprefs.(pref) = value;</span>
3655 <span class="comment">%     setappdata(hfigure,'guiprefs',guiprefs)</span>
3656 <span class="comment">% end</span>
3657 
3658 <span class="comment">% [EOF] store_prefs</span>
3659 
3660 
3661 <span class="comment">% --------------------------------------------------------------------</span>
3662 <a name="_sub94" href="#_subfunctions" class="code">function initGUI(handles)</a>
3663 <span class="comment">% Initialize the UI controls in the GUI.</span>
3664 
3665 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
3666 
3667 <span class="comment">% Set the name and version</span>
3668 set(handles.figure1,<span class="string">'Name'</span>,[<span class="string">'Velocity Mapping Toolbox (VMT) '</span> guiparams.vmt_version], <span class="keyword">...</span>
3669     <span class="string">'DockControls'</span>,<span class="string">'off'</span>)
3670 <span class="comment">%set(handles.VMTversion,             'String',guiparams.vmt_version)</span>
3671 
3672 <span class="comment">% Set the PLOT 1 axis labels</span>
3673 axes(handles.Plot1Shiptracks);
3674 set(handles.Plot1Shiptracks,<span class="string">'DataAspectRatio'</span>,[1 1 1],<span class="string">'PlotBoxAspectRatio'</span>,[1 1 1])
3675 xlabel(<span class="string">'UTM Easting (m)'</span>)
3676 ylabel(<span class="string">'UTM Northing (m)'</span>)
3677 box on
3678 grid on
3679 <span class="comment">% ticks_format('%6.0f','%8.0f'); %formats the ticks for UTM</span>
3680 
3681 <span class="comment">%%%%%%%%%%%%</span>
3682 <span class="comment">% MENU BAR %</span>
3683 <span class="comment">%%%%%%%%%%%%</span>
3684 <span class="keyword">if</span> guiparams.english_units
3685     set(handles.menuMetric, <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3686     set(handles.menuEnglish,<span class="string">'Checked'</span>,<span class="string">'on'</span>)
3687 <span class="keyword">else</span>
3688     set(handles.menuMetric, <span class="string">'Checked'</span>,<span class="string">'on'</span>)
3689     set(handles.menuEnglish,<span class="string">'Checked'</span>,<span class="string">'off'</span>)
3690 <span class="keyword">end</span>
3691 
3692 <span class="keyword">if</span> guiparams.set_cross_section_endpoints
3693     set(handles.menuCrossSectionEndpointAutomatic,<span class="string">'Checked'</span>,<span class="string">'off'</span>)
3694     set(handles.menuCrossSectionEndpointManual,   <span class="string">'Checked'</span>,<span class="string">'on'</span>)
3695 <span class="keyword">else</span>
3696     set(handles.menuCrossSectionEndpointAutomatic,<span class="string">'Checked'</span>,<span class="string">'on'</span>)
3697     set(handles.menuCrossSectionEndpointManual,   <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3698 <span class="keyword">end</span>
3699 
3700 
3701 <span class="keyword">if</span> guiparams.print
3702     set(handles.menuPrintFormat,       <span class="string">'Checked'</span>,<span class="string">'on'</span>)
3703     set(handles.menuPresentationFormat,<span class="string">'Checked'</span>,<span class="string">'off'</span>)
3704     set(handles.menuStylePrint,        <span class="string">'Checked'</span>,<span class="string">'on'</span>)
3705     set(handles.menuStylePresentation, <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3706 <span class="keyword">elseif</span> guiparams.presentation
3707     set(handles.menuPrintFormat,       <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3708     set(handles.menuPresentationFormat,<span class="string">'Checked'</span>,<span class="string">'on'</span>)
3709     set(handles.menuStylePrint,        <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3710     set(handles.menuStylePresentation, <span class="string">'Checked'</span>,<span class="string">'on'</span>)
3711 <span class="keyword">else</span>
3712 <span class="keyword">end</span>
3713 
3714 <span class="keyword">switch</span> guiparams.renderer
3715     <span class="keyword">case</span> <span class="string">'OpenGL'</span>
3716         set(handles.menuOpenGL,        <span class="string">'Checked'</span>,<span class="string">'on'</span>)
3717         set(handles.menuPainters,      <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3718         set(handles.menuZbuffer,       <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3719     <span class="keyword">case</span> <span class="string">'painters'</span>
3720         set(handles.menuOpenGL,        <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3721         set(handles.menuPainters,      <span class="string">'Checked'</span>,<span class="string">'on'</span>)
3722         set(handles.menuZbuffer,       <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3723     <span class="keyword">case</span> <span class="string">'zbuffer'</span>
3724         set(handles.menuOpenGL,        <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3725         set(handles.menuPainters,      <span class="string">'Checked'</span>,<span class="string">'off'</span>)
3726         set(handles.menuZbuffer,       <span class="string">'Checked'</span>,<span class="string">'on'</span>)
3727 <span class="keyword">end</span>
3728 
3729 
3730 <span class="comment">%%%%%%%%%%%%%%%</span>
3731 <span class="comment">% DATA EXPORT %</span>
3732 <span class="comment">%%%%%%%%%%%%%%%</span>
3733 <span class="comment">% BathymetryPanel</span>
3734 <span class="comment">% set(handles.BeamAngle,                  'String',guiparams.beam_angle)</span>
3735 <span class="comment">% set(handles.MagneticVariation,          'String',guiparams.magnetic_variation)</span>
3736 <span class="comment">% set(handles.WSE,                        'String',guiparams.wse)</span>
3737 <span class="comment">% set(handles.OutputAuxiliaryData,        'Value', guiparams.output_auxiliary_data)</span>
3738 
3739 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%</span>
3740 <span class="comment">% PLOTTING/PLAN VIEW %</span>
3741 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%</span>
3742 <span class="comment">% PlanViewPanel</span>
3743 set(handles.DepthRangeMin,              <span class="string">'String'</span>,guiparams.depth_range_min)
3744 set(handles.DepthRangeMax,              <span class="string">'String'</span>,guiparams.depth_range_max)
3745 set(handles.VectorScalePlanView,        <span class="string">'String'</span>,guiparams.vector_scale_plan_view)
3746 set(handles.VectorSpacingPlanview,      <span class="string">'String'</span>,guiparams.vector_spacing_plan_view)
3747 set(handles.SmoothingWindowSize,        <span class="string">'String'</span>,guiparams.smoothing_window_size)
3748 set(handles.DisplayShoreline,           <span class="string">'Value'</span>, guiparams.display_shoreline)
3749 set(handles.AddBackground,              <span class="string">'Value'</span>, guiparams.add_background)
3750 
3751 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%</span>
3752 <span class="comment">% PLOTTING/SHIP TRACKS %</span>
3753 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%</span>
3754 <span class="comment">% ShiptracksPanel</span>
3755 set(handles.HorizontalGridNodeSpacing,  <span class="string">'String'</span>,guiparams.horizontal_grid_node_spacing)
3756 set(handles.VerticalGridNodeSpacing,    <span class="string">'String'</span>,guiparams.vertical_grid_node_spacing)
3757 <span class="comment">%set(handles.SetCrossSectionEndpoints,   'Value', guiparams.set_cross_section_endpoints)</span>
3758 
3759 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
3760 <span class="comment">% PLOTTING/CROSS SECTIONS %</span>
3761 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
3762 <span class="comment">% CrossSectionsPanel</span>
3763 set(handles.Contour,                    <span class="string">'String'</span>,{guiparams.contours.string}, <span class="keyword">...</span>
3764     <span class="string">'Value'</span>, guiparams.idx_contour)
3765 set(handles.VerticalExaggeration,       <span class="string">'String'</span>,guiparams.vertical_exaggeration)
3766 set(handles.VectorScaleCrossSection,    <span class="string">'String'</span>,guiparams.vector_scale_cross_section)
3767 set(handles.HorizontalVectorSpacing,    <span class="string">'String'</span>,guiparams.horizontal_vector_spacing)
3768 set(handles.VerticalVectorSpacing,      <span class="string">'String'</span>,guiparams.vertical_vector_spacing)
3769 set(handles.HorizontalSmoothingWindow,  <span class="string">'String'</span>,guiparams.horizontal_smoothing_window)
3770 set(handles.VerticalSmoothingWindow,    <span class="string">'String'</span>,guiparams.vertical_smoothing_window)
3771 set(handles.PlotSecondaryFlowVectors,   <span class="string">'Value'</span>, guiparams.plot_secondary_flow_vectors)
3772 set(handles.SecondaryFlowVectorVariable,<span class="string">'String'</span>,{guiparams.secondary_flows.string}, <span class="keyword">...</span>
3773     <span class="string">'Value'</span>, guiparams.idx_secondary_flow_vector_variable)
3774 set(handles.IncludeVerticalVelocity,    <span class="string">'Value'</span>, guiparams.include_vertical_velocity)
3775 
3776 <span class="comment">% set(handles.EnglishUnits,               'Value',guiparams.english_units)</span>
3777 
3778 <span class="comment">% [EOF] initGUI</span>
3779 
3780 
3781 <span class="comment">% --------------------------------------------------------------------</span>
3782 <a name="_sub95" href="#_subfunctions" class="code">function set_enable(handles,enable_state)</a>
3783 
3784 guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
3785 
3786 <span class="keyword">switch</span> enable_state
3787     <span class="keyword">case</span> <span class="string">'init'</span>
3788         guiparams.gui_state = <span class="string">'init'</span>;
3789         set([handles.menuFile
3790             handles.menuOpen
3791             handles.menuOpenASCII
3792             handles.menuOpenMAT
3793             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3794         
3795         set([handles.toolbarLoadData
3796             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3797         set([handles.toolbarSaveMatFile
3798             handles.toolbarSaveBathymetry
3799             handles.toolbarSaveFigures
3800             handles.toolbarSaveExcel
3801             handles.toolbarPlottingParameters
3802             handles.toolbarProcessingParameters
3803             ],<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3804         
3805         set([handles.DepthRangeMin
3806             handles.DepthRangeMax
3807             handles.VectorScalePlanView
3808             handles.VectorSpacingPlanview
3809             handles.SmoothingWindowSize
3810             handles.DisplayShoreline
3811             handles.AddBackground
3812             handles.PlotPlanView
3813             ],<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3814         
3815         set([handles.HorizontalGridNodeSpacing
3816             handles.VerticalGridNodeSpacing
3817             handles.PlotShiptracks
3818             ],<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3819         
3820         set([handles.Contour
3821             handles.VerticalExaggeration
3822             handles.VectorScaleCrossSection
3823             handles.HorizontalVectorSpacing
3824             handles.VerticalVectorSpacing
3825             handles.HorizontalSmoothingWindow
3826             handles.VerticalSmoothingWindow
3827             handles.PlotSecondaryFlowVectors
3828             handles.SecondaryFlowVectorVariable
3829             handles.IncludeVerticalVelocity
3830             handles.PlotCrossSection
3831             ],<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3832         
3833     <span class="keyword">case</span> <span class="string">'fileloaded'</span>
3834         guiparams.gui_state = <span class="string">'fileloaded'</span>;
3835         set([handles.menuFile
3836             handles.menuOpen
3837             handles.menuOpenASCII
3838             handles.menuOpenMAT
3839             handles.menuSaveMAT
3840             handles.menuSaveTecplot
3841             handles.menuSaveKMZFile
3842             handles.menuParameters
3843             handles.menuPlottingParameters
3844             handles.menuMetric
3845             handles.menuEnglish
3846             handles.menuBathymetryExportSettings
3847             handles.menuExportMultibeamBathymetry
3848             handles.menuKMZVerticalOffset
3849             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3850         
3851         set([handles.toolbarLoadData
3852             handles.toolbarSaveMatFile
3853             handles.toolbarSaveBathymetry
3854             handles.toolbarSaveExcel
3855             handles.toolbarSaveFigures
3856             handles.toolbarPlottingParameters
3857             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3858         set([handles.toolbarProcessingParameters
3859             ],<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3860         
3861            
3862         set([handles.DepthRangeMin
3863             handles.DepthRangeMax
3864             handles.VectorScalePlanView
3865             handles.VectorSpacingPlanview
3866             handles.SmoothingWindowSize
3867             handles.DisplayShoreline
3868             handles.PlotPlanView
3869             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3870         <span class="keyword">if</span> guiparams.has_mapping_toolbox
3871             set(handles.AddBackground,<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3872         <span class="keyword">else</span>
3873             set(handles.AddBackground,<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3874         <span class="keyword">end</span>
3875         
3876         set([handles.HorizontalGridNodeSpacing
3877             handles.VerticalGridNodeSpacing
3878             handles.PlotShiptracks
3879             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3880         
3881         set([handles.Contour
3882             handles.VerticalExaggeration
3883             handles.VectorScaleCrossSection
3884             handles.HorizontalVectorSpacing
3885             handles.VerticalVectorSpacing
3886             handles.HorizontalSmoothingWindow
3887             handles.VerticalSmoothingWindow
3888             handles.PlotSecondaryFlowVectors
3889             handles.SecondaryFlowVectorVariable
3890             handles.IncludeVerticalVelocity
3891             handles.PlotCrossSection
3892             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3893     <span class="keyword">case</span> <span class="string">'multiplematfiles'</span>
3894         guiparams.gui_state = <span class="string">'multiplematfiles'</span>;
3895         set([handles.menuFile
3896             handles.menuOpen
3897             handles.menuOpenASCII
3898             handles.menuOpenMAT
3899             handles.menuParameters
3900             handles.menuPlottingParameters
3901             handles.menuMetric
3902             handles.menuEnglish
3903             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3904         set([handles.menuSaveMAT
3905             handles.menuBathymetryExportSettings
3906             handles.menuExportMultibeamBathymetry
3907             handles.menuKMZVerticalOffset
3908             handles.menuSaveKMZFile
3909             handles.menuSaveTecplot
3910             ],<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3911         
3912         set([handles.toolbarLoadData
3913             handles.toolbarSaveFigures
3914             handles.toolbarPlottingParameters
3915             handles.toolbarSaveExcel
3916             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3917         set([handles.toolbarProcessingParameters
3918             handles.toolbarSaveMatFile
3919             handles.toolbarSaveBathymetry
3920             ],<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3921         
3922         set([handles.DepthRangeMin
3923             handles.DepthRangeMax
3924             handles.VectorScalePlanView
3925             handles.VectorSpacingPlanview
3926             handles.SmoothingWindowSize
3927             handles.DisplayShoreline
3928             handles.PlotPlanView
3929             ],<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3930         <span class="keyword">if</span> guiparams.has_mapping_toolbox
3931             set(handles.AddBackground,<span class="string">'Enable'</span>,<span class="string">'on'</span>)
3932         <span class="keyword">else</span>
3933             set(handles.AddBackground,<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3934         <span class="keyword">end</span>
3935         
3936         set([handles.HorizontalGridNodeSpacing
3937             handles.VerticalGridNodeSpacing
3938             handles.PlotShiptracks
3939             ],<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3940         
3941         set([handles.Contour
3942             handles.VerticalExaggeration
3943             handles.VectorScaleCrossSection
3944             handles.HorizontalVectorSpacing
3945             handles.VerticalVectorSpacing
3946             handles.HorizontalSmoothingWindow
3947             handles.VerticalSmoothingWindow
3948             handles.PlotSecondaryFlowVectors
3949             handles.SecondaryFlowVectorVariable
3950             handles.IncludeVerticalVelocity
3951             handles.PlotCrossSection
3952             ],<span class="string">'Enable'</span>,<span class="string">'off'</span>)
3953     <span class="keyword">otherwise</span>
3954 <span class="keyword">end</span>
3955 
3956 <span class="comment">% Save Application Data</span>
3957 setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
3958 
3959 <span class="comment">% [EOF] set_enable</span>
3960 
3961 <span class="comment">%% Compute the longitudinal dispersion coefficient</span>
3962 
3963 <span class="comment">%% --- Executes on button press in zerosecq_chkbox.</span>
3964 <span class="comment">%function zerosecq_chkbox_Callback(hObject, eventdata, handles)</span>
3965 <span class="comment">% hObject    handle to zerosecq_chkbox (see GCBO)</span>
3966 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
3967 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
3968 
3969 <span class="comment">% Hint: get(hObject,'Value') returns toggle state of zerosecq_chkbox</span>
3970 
3971 
3972 <span class="comment">% --------------------------------------------------------------------</span>
3973 <a name="_sub96" href="#_subfunctions" class="code">function [english_units,set_cross_section_endpoints,plot_presentation_style,plot_print_style] = </a><span class="keyword">...</span>
3974     plotParametersDialog(english_units,set_cross_section_endpoints,plot_presentation_style,plot_print_style,hf)
3975 
3976 w = 500;
3977 h = 110;
3978 dx = 10;
3979 dy = 35;
3980 the_color = get(0,<span class="string">'factoryUipanelBackgroundColor'</span>);
3981 handles.Figure = figure(<span class="string">'Name'</span>, <span class="string">'Plotting Parameters'</span>, <span class="keyword">...</span>
3982     <span class="string">'Color'</span>,the_color, <span class="keyword">...</span>
3983     <span class="string">'NumberTitle'</span>,<span class="string">'off'</span>, <span class="keyword">...</span>
3984     <span class="string">'HandleVisibility'</span>,<span class="string">'callback'</span>, <span class="keyword">...</span>
3985     <span class="string">'WindowStyle'</span>,<span class="string">'modal'</span>, <span class="keyword">...</span>
3986     <span class="string">'MenuBar'</span>,<span class="string">'none'</span>, <span class="keyword">...</span>
3987     <span class="string">'ToolBar'</span>,<span class="string">'none'</span>, <span class="keyword">...</span>
3988     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
3989     <span class="string">'Position'</span>,[0 0 w h], <span class="keyword">...</span>
3990     <span class="string">'Resize'</span>,<span class="string">'off'</span>, <span class="keyword">...</span>
3991     <span class="string">'Visible'</span>,<span class="string">'off'</span>);
3992 dialog_params.english_units               = english_units;
3993 dialog_params.set_cross_section_endpoints = set_cross_section_endpoints;
3994 dialog_params.presentation                = plot_presentation_style; <span class="comment">%presentation;</span>
3995 dialog_params.print                       = plot_print_style; <span class="comment">%print;</span>
3996 setappdata(handles.Figure,<span class="string">'dialog_params'</span>,dialog_params)
3997 setappdata(handles.Figure,<span class="string">'original_dialog_params'</span>,dialog_params)
3998 
3999 <span class="comment">% Build the graphics:</span>
4000 <span class="comment">% -------------------</span>
4001 handles.UnitsPanel = uipanel(<span class="string">'Parent'</span>,handles.Figure, <span class="keyword">...</span>
4002     <span class="string">'Title'</span>, <span class="string">'Units'</span>, <span class="keyword">...</span>
4003     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4004     <span class="string">'Position'</span>,[dx dy (w-3*dx)/3 h-dx-dy+10]);
4005 handles.UnitsMetric = uicontrol(<span class="string">'Style'</span>,<span class="string">'checkbox'</span>, <span class="keyword">...</span>
4006     <span class="string">'Parent'</span>,handles.UnitsPanel, <span class="keyword">...</span>
4007     <span class="string">'String'</span>,<span class="string">'Metric'</span>, <span class="keyword">...</span>
4008     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4009     <span class="string">'Position'</span>,[15 35 100 22]);
4010 handles.UnitsEnglish = uicontrol(<span class="string">'Style'</span>,<span class="string">'checkbox'</span>, <span class="keyword">...</span>
4011     <span class="string">'Parent'</span>,handles.UnitsPanel, <span class="keyword">...</span>
4012     <span class="string">'String'</span>,<span class="string">'English'</span>, <span class="keyword">...</span>
4013     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4014     <span class="string">'Position'</span>,[15 10 100 22]);
4015 
4016 handles.EndpointsPanel = uipanel(<span class="string">'Parent'</span>,handles.Figure, <span class="keyword">...</span>
4017     <span class="string">'Title'</span>, <span class="string">'Cross-Section Endpoints'</span>, <span class="keyword">...</span>
4018     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4019     <span class="string">'Position'</span>,[(w+dx)/3 dy (w-3*dx)/3 h-dx-dy+10]);
4020 handles.EndpointsAutomatic = uicontrol(<span class="string">'Style'</span>,<span class="string">'checkbox'</span>, <span class="keyword">...</span>
4021     <span class="string">'Parent'</span>,handles.EndpointsPanel, <span class="keyword">...</span>
4022     <span class="string">'String'</span>,<span class="string">'Automatic'</span>, <span class="keyword">...</span>
4023     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4024     <span class="string">'Position'</span>,[15 35 100 22]);
4025 handles.EndpointsManual = uicontrol(<span class="string">'Style'</span>,<span class="string">'checkbox'</span>, <span class="keyword">...</span>
4026     <span class="string">'Parent'</span>,handles.EndpointsPanel, <span class="keyword">...</span>
4027     <span class="string">'String'</span>,<span class="string">'Set Manually'</span>, <span class="keyword">...</span>
4028     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4029     <span class="string">'Position'</span>,[15 10 100 22]);
4030 
4031 handles.StylePanel = uipanel(<span class="string">'Parent'</span>,handles.Figure, <span class="keyword">...</span>
4032     <span class="string">'Title'</span>, <span class="string">'Plot Style'</span>, <span class="keyword">...</span>
4033     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4034     <span class="string">'Position'</span>,[w-w/3 dy (w-3*dx)/3 h-dx-dy+10]);
4035 handles.StylePresentation = uicontrol(<span class="string">'Style'</span>,<span class="string">'checkbox'</span>, <span class="keyword">...</span>
4036     <span class="string">'Parent'</span>,handles.StylePanel, <span class="keyword">...</span>
4037     <span class="string">'String'</span>,<span class="string">'Presentation'</span>, <span class="keyword">...</span>
4038     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4039     <span class="string">'Position'</span>,[15 35 100 22]);
4040 handles.StylePrint = uicontrol(<span class="string">'Style'</span>,<span class="string">'checkbox'</span>, <span class="keyword">...</span>
4041     <span class="string">'Parent'</span>,handles.StylePanel, <span class="keyword">...</span>
4042     <span class="string">'String'</span>,<span class="string">'Print'</span>, <span class="keyword">...</span>
4043     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4044     <span class="string">'Position'</span>,[15 10 100 22]);
4045 
4046 handles.OK = uicontrol(<span class="string">'Style'</span>,   <span class="string">'pushbutton'</span>, <span class="keyword">...</span>
4047     <span class="string">'Parent'</span>,  handles.Figure, <span class="keyword">...</span>
4048     <span class="string">'String'</span>,  <span class="string">'OK'</span>, <span class="keyword">...</span>
4049     <span class="string">'Units'</span>,   <span class="string">'pixels'</span>, <span class="keyword">...</span>
4050     <span class="string">'Position'</span>,[w/2-80-dx/4 6 80 22]);
4051 handles.Cancel = uicontrol(<span class="string">'Style'</span>,   <span class="string">'pushbutton'</span>, <span class="keyword">...</span>
4052     <span class="string">'Parent'</span>,  handles.Figure, <span class="keyword">...</span>
4053     <span class="string">'String'</span>,  <span class="string">'Cancel'</span>, <span class="keyword">...</span>
4054     <span class="string">'Units'</span>,   <span class="string">'pixels'</span>, <span class="keyword">...</span>
4055     <span class="string">'Position'</span>,[w/2+dx/4 6 80 22]);
4056 
4057 <span class="comment">% Update the UI controls:</span>
4058 <span class="comment">% -----------------------</span>
4059 <span class="keyword">if</span> dialog_params.english_units
4060     set(handles.UnitsMetric, <span class="string">'Value'</span>,0)
4061     set(handles.UnitsEnglish,<span class="string">'Value'</span>,1)
4062 <span class="keyword">else</span>
4063     set(handles.UnitsMetric, <span class="string">'Value'</span>,1)
4064     set(handles.UnitsEnglish,<span class="string">'Value'</span>,0)
4065 <span class="keyword">end</span>
4066 <span class="keyword">if</span> dialog_params.set_cross_section_endpoints
4067     set(handles.EndpointsAutomatic,<span class="string">'Value'</span>,0)
4068     set(handles.EndpointsManual,   <span class="string">'Value'</span>,1)
4069 <span class="keyword">else</span>
4070     set(handles.EndpointsAutomatic,<span class="string">'Value'</span>,1)
4071     set(handles.EndpointsManual,   <span class="string">'Value'</span>,0)
4072 <span class="keyword">end</span>
4073 <span class="keyword">if</span> dialog_params.presentation
4074     set(handles.StylePresentation, <span class="string">'Value'</span>,1)
4075     set(handles.StylePrint,        <span class="string">'Value'</span>,0)
4076 <span class="keyword">else</span>
4077     set(handles.StylePresentation, <span class="string">'Value'</span>,0)
4078     set(handles.StylePrint,        <span class="string">'Value'</span>,1)
4079 <span class="keyword">end</span>
4080 
4081 <span class="comment">% Set the callbacks:</span>
4082 <span class="comment">% ------------------</span>
4083 set(handles.Figure,            <span class="string">'CloseRequestFcn'</span>,{@<a href="#_sub102" class="code" title="subfunction dialogCloseReq(hObject,eventdata,h_OK)">dialogCloseReq</a>, handles.OK})
4084 set(handles.UnitsMetric,       <span class="string">'Callback'</span>,       {@<a href="#_sub97" class="code" title="subfunction dialogUnits(hObject,eventdata,handles,the_units)">dialogUnits</a>,    handles,<span class="string">'metric'</span>})
4085 set(handles.UnitsEnglish,      <span class="string">'Callback'</span>,       {@<a href="#_sub97" class="code" title="subfunction dialogUnits(hObject,eventdata,handles,the_units)">dialogUnits</a>,    handles,<span class="string">'english'</span>})
4086 set(handles.EndpointsAutomatic,<span class="string">'Callback'</span>,       {@<a href="#_sub98" class="code" title="subfunction dialogEnpoints(hObject,eventdata,handles,the_endpoints)">dialogEnpoints</a>, handles,<span class="string">'auto'</span>})
4087 set(handles.EndpointsManual,   <span class="string">'Callback'</span>,       {@<a href="#_sub98" class="code" title="subfunction dialogEnpoints(hObject,eventdata,handles,the_endpoints)">dialogEnpoints</a>, handles,<span class="string">'manual'</span>})
4088 set(handles.StylePresentation, <span class="string">'Callback'</span>,       {@<a href="#_sub99" class="code" title="subfunction dialogPlotStyle(hObject,eventdata,handles,the_style)">dialogPlotStyle</a>,handles,<span class="string">'presentation'</span>})
4089 set(handles.StylePrint,        <span class="string">'Callback'</span>,       {@<a href="#_sub99" class="code" title="subfunction dialogPlotStyle(hObject,eventdata,handles,the_style)">dialogPlotStyle</a>,handles,<span class="string">'print'</span>})
4090 set(handles.OK,                <span class="string">'Callback'</span>,       {@<a href="#_sub100" class="code" title="subfunction dialogOK(hObject,eventdata,h_OK)">dialogOK</a>,       handles.OK})
4091 set(handles.Cancel,            <span class="string">'Callback'</span>,       {@<a href="#_sub101" class="code" title="subfunction dialogCancel(hObject,eventdata,handles)">dialogCancel</a>,   handles})
4092 
4093 <span class="comment">% Position the dialog and make it visible:</span>
4094 <span class="comment">% ----------------------------------------</span>
4095 fpos = get(hf,<span class="string">'Position'</span>);
4096 dpos = [(fpos(1) + fpos(3)/2 -w/2) (fpos(2) + fpos(4)/2)];
4097 movegui(handles.Figure,dpos)
4098 set(handles.Figure,<span class="string">'Visible'</span>,<span class="string">'on'</span>)
4099 
4100 <span class="comment">% Hold the dialog open:</span>
4101 <span class="comment">% ---------------------</span>
4102 waitfor(handles.OK)
4103 
4104 <span class="comment">% Return the outputs and close the dialog:</span>
4105 <span class="comment">% ----------------------------------------</span>
4106 dialog_params = getappdata(handles.Figure,<span class="string">'dialog_params'</span>);
4107 english_units = dialog_params.english_units;
4108 set_cross_section_endpoints = dialog_params.set_cross_section_endpoints;
4109 plot_presentation_style =  dialog_params.presentation;
4110 plot_print_style =  dialog_params.print;
4111 
4112 delete(handles.Figure)
4113 
4114 <span class="comment">% [EOF] plotParametersDialog</span>
4115 
4116 
4117 <span class="comment">% --------------------------------------------------------------------</span>
4118 <a name="_sub97" href="#_subfunctions" class="code">function dialogUnits(hObject,eventdata,handles,the_units)</a>
4119 
4120 dialog_params = getappdata(handles.Figure,<span class="string">'dialog_params'</span>);
4121 <span class="keyword">switch</span> the_units
4122     <span class="keyword">case</span> <span class="string">'metric'</span>
4123         dialog_params.english_units = false;
4124         
4125         set(handles.UnitsMetric, <span class="string">'Value'</span>,1)
4126         set(handles.UnitsEnglish,<span class="string">'Value'</span>,0)
4127     <span class="keyword">case</span> <span class="string">'english'</span>
4128         dialog_params.english_units = true;
4129         
4130         set(handles.UnitsMetric, <span class="string">'Value'</span>,0)
4131         set(handles.UnitsEnglish,<span class="string">'Value'</span>,1)
4132     <span class="keyword">otherwise</span>
4133 <span class="keyword">end</span>
4134 setappdata(handles.Figure,<span class="string">'dialog_params'</span>,dialog_params)
4135 
4136 <span class="comment">% [EOF] dialogUnits</span>
4137 
4138 <span class="comment">% --------------------------------------------------------------------</span>
4139 <a name="_sub98" href="#_subfunctions" class="code">function dialogEnpoints(hObject,eventdata,handles,the_endpoints)</a>
4140 
4141 dialog_params = getappdata(handles.Figure,<span class="string">'dialog_params'</span>);
4142 <span class="keyword">switch</span> the_endpoints
4143     <span class="keyword">case</span> <span class="string">'auto'</span>
4144         dialog_params.set_cross_section_endpoints = false;
4145         
4146         set(handles.EndpointsAutomatic,<span class="string">'Value'</span>,1)
4147         set(handles.EndpointsManual,   <span class="string">'Value'</span>,0)
4148     <span class="keyword">case</span> <span class="string">'manual'</span>
4149         dialog_params.set_cross_section_endpoints = true;
4150         
4151         set(handles.EndpointsAutomatic,<span class="string">'Value'</span>,0)
4152         set(handles.EndpointsManual,   <span class="string">'Value'</span>,1)
4153     <span class="keyword">otherwise</span>
4154 <span class="keyword">end</span>
4155 setappdata(handles.Figure,<span class="string">'dialog_params'</span>,dialog_params)
4156 
4157 <span class="comment">% [EOF] dialogEnpoints</span>
4158 
4159 <a name="_sub99" href="#_subfunctions" class="code">function dialogPlotStyle(hObject,eventdata,handles,the_style)</a>
4160 
4161 dialog_params = getappdata(handles.Figure,<span class="string">'dialog_params'</span>);
4162 <span class="keyword">switch</span> the_style
4163     <span class="keyword">case</span> <span class="string">'presentation'</span>
4164         dialog_params.presentation  = true;
4165         dialog_params.print         = false;
4166         
4167         set(handles.StylePresentation,<span class="string">'Value'</span>,1)
4168         set(handles.StylePrint,       <span class="string">'Value'</span>,0)
4169     <span class="keyword">case</span> <span class="string">'print'</span>
4170         dialog_params.presentation  = false;
4171         dialog_params.print         = true;
4172         
4173         set(handles.StylePresentation,<span class="string">'Value'</span>,0)
4174         set(handles.StylePrint,       <span class="string">'Value'</span>,1)
4175     <span class="keyword">otherwise</span>
4176 <span class="keyword">end</span>
4177 setappdata(handles.Figure,<span class="string">'dialog_params'</span>,dialog_params)
4178 
4179 <span class="comment">% [EOF] dialogEnpoints</span>
4180 
4181 <span class="comment">% --------------------------------------------------------------------</span>
4182 <a name="_sub100" href="#_subfunctions" class="code">function dialogOK(hObject,eventdata,h_OK)</a>
4183 
4184 delete(h_OK)
4185 
4186 <span class="comment">% [EOF] dialogOK</span>
4187 
4188 <span class="comment">% --------------------------------------------------------------------</span>
4189 <a name="_sub101" href="#_subfunctions" class="code">function dialogCancel(hObject,eventdata,handles)</a>
4190 <span class="comment">% Return the original inputs</span>
4191 dialog_params = getappdata(handles.Figure,<span class="string">'original_dialog_params'</span>);
4192 setappdata(handles.Figure,<span class="string">'dialog_params'</span>,dialog_params)
4193 delete(handles.OK)
4194 
4195 <span class="comment">% [EOF] dialogCancel</span>
4196 
4197 <span class="comment">% --------------------------------------------------------------------</span>
4198 <a name="_sub102" href="#_subfunctions" class="code">function dialogCloseReq(hObject,eventdata,h_OK)</a>
4199 
4200 delete(h_OK)
4201 
4202 <span class="comment">% [EOF] dialogCloseReq</span>
4203 
4204 <a name="_sub103" href="#_subfunctions" class="code">function [beam_angle,magnetic_variation,wse,output_auxiliary_data] = exportSettingsDialog(beam_angle,magnetic_variation,wse,output_auxiliary_data,hf)</a>
4205 w = 230;
4206 h = 200;
4207 dx = 10;
4208 dy = 35;
4209 the_color = get(0,<span class="string">'factoryUipanelBackgroundColor'</span>);
4210 handles.Figure = figure(<span class="string">'Name'</span>, <span class="string">'Export Settings'</span>, <span class="keyword">...</span>
4211     <span class="string">'Color'</span>,the_color, <span class="keyword">...</span>
4212     <span class="string">'NumberTitle'</span>,<span class="string">'off'</span>, <span class="keyword">...</span>
4213     <span class="string">'HandleVisibility'</span>,<span class="string">'callback'</span>, <span class="keyword">...</span>
4214     <span class="string">'WindowStyle'</span>,<span class="string">'modal'</span>, <span class="keyword">...</span>
4215     <span class="string">'MenuBar'</span>,<span class="string">'none'</span>, <span class="keyword">...</span>
4216     <span class="string">'ToolBar'</span>,<span class="string">'none'</span>, <span class="keyword">...</span>
4217     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4218     <span class="string">'Position'</span>,[0 0 w h], <span class="keyword">...</span>
4219     <span class="string">'Resize'</span>,<span class="string">'off'</span>, <span class="keyword">...</span>
4220     <span class="string">'Visible'</span>,<span class="string">'off'</span>);
4221 dialog_params.beam_angle             = beam_angle;
4222 dialog_params.magnetic_variation     = magnetic_variation;
4223 dialog_params.wse                    = wse;
4224 dialog_params.output_auxiliary_data = output_auxiliary_data;
4225 setappdata(handles.Figure,<span class="string">'dialog_params'</span>,dialog_params)
4226 setappdata(handles.Figure,<span class="string">'original_dialog_params'</span>,dialog_params)
4227 
4228 <span class="comment">% Build the graphics:</span>
4229 <span class="comment">% -------------------</span>
4230 ph = 150;
4231 handles.BathymetryPanel = uipanel(<span class="string">'Parent'</span>,handles.Figure, <span class="keyword">...</span>
4232     <span class="string">'Title'</span>, <span class="string">'Bathymetry'</span>, <span class="keyword">...</span>
4233     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4234     <span class="string">'Position'</span>,[dx dy (w-2*dx) h-dx-dy+10]);
4235 handles.BeamAngleText = uicontrol(<span class="string">'Style'</span>,<span class="string">'text'</span>, <span class="keyword">...</span>
4236     <span class="string">'Parent'</span>,handles.BathymetryPanel, <span class="keyword">...</span>
4237     <span class="string">'String'</span>,<span class="string">'Beam Angle (deg)'</span>, <span class="keyword">...</span>
4238     <span class="keyword">...</span><span class="comment">'Value',beam_angle,...</span>
4239     <span class="string">'HorizontalAlignment'</span>,<span class="string">'right'</span>,<span class="keyword">...</span>
4240     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4241     <span class="string">'Position'</span>,[dx+5 h-ph+60-4 100 22]);
4242 handles.BeamAngle = uicontrol(<span class="string">'Style'</span>,<span class="string">'edit'</span>, <span class="keyword">...</span>
4243     <span class="string">'Parent'</span>,handles.BathymetryPanel, <span class="keyword">...</span>
4244     <span class="keyword">...</span><span class="comment">'String','Beam Angle (deg)', ...</span>
4245     <span class="string">'String'</span>,beam_angle,<span class="keyword">...</span>
4246     <span class="string">'BackgroundColor'</span>,<span class="string">'w'</span>,<span class="keyword">...</span>
4247     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4248     <span class="string">'Position'</span>,[w-dx-80 h-ph+60 50 22]);
4249 handles.MagneticVariationText = uicontrol(<span class="string">'Style'</span>,<span class="string">'text'</span>, <span class="keyword">...</span>
4250     <span class="string">'Parent'</span>,handles.BathymetryPanel, <span class="keyword">...</span>
4251     <span class="string">'String'</span>,<span class="string">'Magnetic Variation'</span>, <span class="keyword">...</span>
4252     <span class="keyword">...</span><span class="comment">'Value',beam_angle,...</span>
4253     <span class="string">'HorizontalAlignment'</span>,<span class="string">'right'</span>,<span class="keyword">...</span>
4254     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4255     <span class="string">'Position'</span>,[dx+5 h-ph+30-4 100 22]);
4256 handles.MagneticVariation = uicontrol(<span class="string">'Style'</span>,<span class="string">'edit'</span>, <span class="keyword">...</span>
4257     <span class="string">'Parent'</span>,handles.BathymetryPanel, <span class="keyword">...</span>
4258     <span class="keyword">...</span><span class="comment">'String','Magnetic Variation', ...</span>
4259     <span class="string">'String'</span>,magnetic_variation,<span class="keyword">...</span>
4260     <span class="string">'BackgroundColor'</span>,<span class="string">'w'</span>,<span class="keyword">...</span>
4261     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4262     <span class="string">'Position'</span>,[w-dx-80 h-ph+30 50 22]);
4263 handles.WSEText = uicontrol(<span class="string">'Style'</span>,<span class="string">'text'</span>, <span class="keyword">...</span>
4264     <span class="string">'Parent'</span>,handles.BathymetryPanel, <span class="keyword">...</span>
4265     <span class="string">'String'</span>,<span class="string">'WSE (m)'</span>, <span class="keyword">...</span>
4266     <span class="keyword">...</span><span class="comment">'Value',beam_angle,...</span>
4267     <span class="string">'HorizontalAlignment'</span>,<span class="string">'right'</span>,<span class="keyword">...</span>
4268     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4269     <span class="string">'Position'</span>,[dx+5 h-ph-4 100 22]);
4270 handles.WSE = uicontrol(<span class="string">'Style'</span>,<span class="string">'edit'</span>, <span class="keyword">...</span>
4271     <span class="string">'Parent'</span>,handles.BathymetryPanel, <span class="keyword">...</span>
4272     <span class="keyword">...</span><span class="comment">'String','Magnetic Variation', ...</span>
4273     <span class="string">'String'</span>,num2str(wse),<span class="keyword">...</span>
4274     <span class="string">'BackgroundColor'</span>,<span class="string">'w'</span>,<span class="keyword">...</span>
4275     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4276     <span class="string">'Position'</span>,[w-dx-80 h-ph 50 22]);
4277 handles.OutputauxiliaryData = uicontrol(<span class="string">'Style'</span>,<span class="string">'checkbox'</span>, <span class="keyword">...</span>
4278     <span class="string">'Parent'</span>,handles.BathymetryPanel, <span class="keyword">...</span>
4279     <span class="string">'String'</span>,<span class="string">'Output auxiliary Data'</span>, <span class="keyword">...</span>
4280     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4281     <span class="string">'Position'</span>,[dx+5 20 w-2*dx-30 22]);
4282 handles.OK = uicontrol(<span class="string">'Style'</span>,   <span class="string">'pushbutton'</span>, <span class="keyword">...</span>
4283     <span class="string">'Parent'</span>,  handles.Figure, <span class="keyword">...</span>
4284     <span class="string">'String'</span>,  <span class="string">'OK'</span>, <span class="keyword">...</span>
4285     <span class="string">'Units'</span>,   <span class="string">'pixels'</span>, <span class="keyword">...</span>
4286     <span class="string">'Position'</span>,[w/2-80-dx/4 6 80 22]);
4287 handles.Cancel = uicontrol(<span class="string">'Style'</span>,   <span class="string">'pushbutton'</span>, <span class="keyword">...</span>
4288     <span class="string">'Parent'</span>,  handles.Figure, <span class="keyword">...</span>
4289     <span class="string">'String'</span>,  <span class="string">'Cancel'</span>, <span class="keyword">...</span>
4290     <span class="string">'Units'</span>,   <span class="string">'pixels'</span>, <span class="keyword">...</span>
4291     <span class="string">'Position'</span>,[w/2+dx/4 6 80 22]);
4292 
4293 <span class="comment">% Update the UI controls:</span>
4294 <span class="comment">% -----------------------</span>
4295 set(handles.BeamAngle,                <span class="string">'String'</span>,dialog_params.beam_angle)
4296 set(handles.MagneticVariation,        <span class="string">'String'</span>,dialog_params.magnetic_variation)
4297 set(handles.WSE,                      <span class="string">'String'</span>,dialog_params.wse)
4298 set(handles.OutputauxiliaryData,     <span class="string">'Value'</span>, double(dialog_params.output_auxiliary_data))
4299 
4300 <span class="comment">% Set the callbacks:</span>
4301 <span class="comment">% ------------------</span>
4302 set(handles.Figure,                      <span class="string">'CloseRequestFcn'</span>,{@<a href="#_sub102" class="code" title="subfunction dialogCloseReq(hObject,eventdata,h_OK)">dialogCloseReq</a>,handles.OK})
4303 set(handles.BeamAngle,                   <span class="string">'Callback'</span>,       {@<a href="#_sub104" class="code" title="subfunction dialogExportSettings(hObject,eventdata,handles)">dialogExportSettings</a>,handles})
4304 set(handles.MagneticVariation,           <span class="string">'Callback'</span>,       {@<a href="#_sub104" class="code" title="subfunction dialogExportSettings(hObject,eventdata,handles)">dialogExportSettings</a>,handles})
4305 set(handles.WSE,                         <span class="string">'Callback'</span>,       {@<a href="#_sub104" class="code" title="subfunction dialogExportSettings(hObject,eventdata,handles)">dialogExportSettings</a>,handles})
4306 set(handles.OutputauxiliaryData,         <span class="string">'Callback'</span>,       {@<a href="#_sub104" class="code" title="subfunction dialogExportSettings(hObject,eventdata,handles)">dialogExportSettings</a>,handles})
4307 set(handles.OK,                          <span class="string">'Callback'</span>,       {@<a href="#_sub100" class="code" title="subfunction dialogOK(hObject,eventdata,h_OK)">dialogOK</a>,      handles.OK})
4308 set(handles.Cancel,                      <span class="string">'Callback'</span>,       {@<a href="#_sub101" class="code" title="subfunction dialogCancel(hObject,eventdata,handles)">dialogCancel</a>,  handles})
4309 
4310 <span class="comment">% Position the dialog and make it visible:</span>
4311 <span class="comment">% ----------------------------------------</span>
4312 fpos = get(hf,<span class="string">'Position'</span>);
4313 dpos = [(fpos(1) + fpos(3)/2 -w/2) (fpos(2) + fpos(4)/2)];
4314 movegui(handles.Figure,dpos)
4315 set(handles.Figure,<span class="string">'Visible'</span>,<span class="string">'on'</span>)
4316 
4317 <span class="comment">% Hold the dialog open:</span>
4318 <span class="comment">% ---------------------</span>
4319 waitfor(handles.OK)
4320 
4321 <span class="comment">% Return the outputs and close the dialog:</span>
4322 <span class="comment">% ----------------------------------------</span>
4323 dialog_params           = getappdata(handles.Figure,<span class="string">'dialog_params'</span>);
4324 beam_angle              = dialog_params.beam_angle;
4325 magnetic_variation      = dialog_params.magnetic_variation;
4326 wse                     = str2double(dialog_params.wse);
4327 output_auxiliary_data  = logical(dialog_params.output_auxiliary_data);
4328 
4329 delete(handles.Figure)
4330 
4331 <span class="comment">% [EOF] exportSettingsDialog</span>
4332 
4333 <span class="comment">% --------------------------------------------------------------------</span>
4334 <a name="_sub104" href="#_subfunctions" class="code">function dialogExportSettings(hObject,eventdata,handles)</a>
4335 
4336 <span class="comment">% Grab the current data</span>
4337 dialog_params = getappdata(handles.Figure,<span class="string">'dialog_params'</span>);
4338 
4339 <span class="comment">% Set it according to the dialog box values</span>
4340 dialog_params.beam_angle                = get(handles.BeamAngle,<span class="string">'String'</span>);
4341 dialog_params.magnetic_variation        = get(handles.MagneticVariation,<span class="string">'String'</span>);
4342 dialog_params.wse                       = get(handles.WSE,<span class="string">'String'</span>);
4343 dialog_params.output_auxiliary_data    = get(handles.OutputauxiliaryData,<span class="string">'Value'</span>);
4344 
4345 <span class="comment">% Re-store the application data</span>
4346 setappdata(handles.Figure,<span class="string">'dialog_params'</span>,dialog_params)
4347 
4348 <span class="comment">% [EOF] dialogExportSettings</span>
4349 
4350 <a name="_sub105" href="#_subfunctions" class="code">function [selected_figures] = openFiguresDialog(figure_names,hf)</a>
4351 
4352 w = 230;
4353 h = 200;
4354 dx = 10;
4355 dy = 35;
4356 the_color = get(0,<span class="string">'factoryUipanelBackgroundColor'</span>);
4357 handles.Figure = figure(<span class="string">'Name'</span>, <span class="string">'Select open figures to export'</span>, <span class="keyword">...</span>
4358     <span class="string">'Color'</span>,the_color, <span class="keyword">...</span>
4359     <span class="string">'NumberTitle'</span>,<span class="string">'off'</span>, <span class="keyword">...</span>
4360     <span class="string">'HandleVisibility'</span>,<span class="string">'callback'</span>, <span class="keyword">...</span>
4361     <span class="string">'WindowStyle'</span>,<span class="string">'modal'</span>, <span class="keyword">...</span>
4362     <span class="string">'MenuBar'</span>,<span class="string">'none'</span>, <span class="keyword">...</span>
4363     <span class="string">'ToolBar'</span>,<span class="string">'none'</span>, <span class="keyword">...</span>
4364     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4365     <span class="string">'Position'</span>,[0 0 w h], <span class="keyword">...</span>
4366     <span class="string">'Resize'</span>,<span class="string">'off'</span>, <span class="keyword">...</span>
4367     <span class="string">'Visible'</span>,<span class="string">'off'</span>);
4368 dialog_params.figure_names               = figure_names;
4369 dialog_params.selected_figures           = <span class="string">''</span>;
4370 setappdata(handles.Figure,<span class="string">'dialog_params'</span>,dialog_params)
4371 setappdata(handles.Figure,<span class="string">'original_dialog_params'</span>,dialog_params)
4372 
4373 <span class="comment">% Build the graphics:</span>
4374 <span class="comment">% -------------------</span>
4375 handles.ListboxPanel = uipanel(<span class="string">'Parent'</span>,handles.Figure, <span class="keyword">...</span>
4376     <span class="string">'Title'</span>, <span class="string">'Figures'</span>, <span class="keyword">...</span>
4377     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4378     <span class="string">'Position'</span>,[dx dy (w-2*dx) h-dx-dy+10]);
4379 handles.Figures = uicontrol(<span class="string">'Style'</span>,<span class="string">'listbox'</span>, <span class="keyword">...</span>
4380     <span class="string">'Parent'</span>,handles.ListboxPanel, <span class="keyword">...</span>
4381     <span class="string">'BackGroundColor'</span>,<span class="string">'white'</span>,<span class="keyword">...</span>
4382     <span class="string">'String'</span>,figure_names, <span class="keyword">...</span>
4383     <span class="string">'Min'</span>, 0,<span class="keyword">...</span>
4384     <span class="string">'Max'</span>, 2,<span class="keyword">...</span>
4385     <span class="string">'Units'</span>,<span class="string">'pixels'</span>, <span class="keyword">...</span>
4386     <span class="string">'Position'</span>,[15 35 (w-5*dx) 100]);
4387 
4388 
4389 handles.OK = uicontrol(<span class="string">'Style'</span>,   <span class="string">'pushbutton'</span>, <span class="keyword">...</span>
4390     <span class="string">'Parent'</span>,  handles.Figure, <span class="keyword">...</span>
4391     <span class="string">'String'</span>,  <span class="string">'OK'</span>, <span class="keyword">...</span>
4392     <span class="string">'Units'</span>,   <span class="string">'pixels'</span>, <span class="keyword">...</span>
4393     <span class="string">'Position'</span>,[w/2-80-dx/4 6 80 22]);
4394 handles.Cancel = uicontrol(<span class="string">'Style'</span>,   <span class="string">'pushbutton'</span>, <span class="keyword">...</span>
4395     <span class="string">'Parent'</span>,  handles.Figure, <span class="keyword">...</span>
4396     <span class="string">'String'</span>,  <span class="string">'Cancel'</span>, <span class="keyword">...</span>
4397     <span class="string">'Units'</span>,   <span class="string">'pixels'</span>, <span class="keyword">...</span>
4398     <span class="string">'Position'</span>,[w/2+dx/4 6 80 22]);
4399 
4400 <span class="comment">% Update the UI controls:</span>
4401 <span class="comment">% -----------------------</span>
4402 
4403 
4404 <span class="comment">% Set the callbacks:</span>
4405 <span class="comment">% ------------------</span>
4406 set(handles.Figure,            <span class="string">'CloseRequestFcn'</span>,{@<a href="#_sub102" class="code" title="subfunction dialogCloseReq(hObject,eventdata,h_OK)">dialogCloseReq</a>,handles.OK})
4407 set(handles.Figures,           <span class="string">'Callback'</span>,       {@<a href="#_sub106" class="code" title="subfunction dialogSelectFigures(hObject,eventdata,handles)">dialogSelectFigures</a>    handles})
4408 set(handles.OK,                <span class="string">'Callback'</span>,       {@<a href="#_sub100" class="code" title="subfunction dialogOK(hObject,eventdata,h_OK)">dialogOK</a>,       handles.OK})
4409 set(handles.Cancel,            <span class="string">'Callback'</span>,       {@<a href="#_sub101" class="code" title="subfunction dialogCancel(hObject,eventdata,handles)">dialogCancel</a>,   handles})
4410 
4411 <span class="comment">% Position the dialog and make it visible:</span>
4412 <span class="comment">% ----------------------------------------</span>
4413 fpos = get(hf,<span class="string">'Position'</span>);
4414 dpos = [(fpos(1) + fpos(3)/2 -w/2) (fpos(2) + fpos(4)/2)];
4415 movegui(handles.Figure,dpos)
4416 set(handles.Figure,<span class="string">'Visible'</span>,<span class="string">'on'</span>)
4417 
4418 <span class="comment">% Hold the dialog open:</span>
4419 <span class="comment">% ---------------------</span>
4420 waitfor(handles.OK)
4421 
4422 <span class="comment">% Return the outputs and close the dialog:</span>
4423 <span class="comment">% ----------------------------------------</span>
4424 dialog_params = getappdata(handles.Figure,<span class="string">'dialog_params'</span>);
4425 selected_figures = dialog_params.selected_figures;
4426 
4427 delete(handles.Figure)
4428 
4429 <span class="comment">% [EOF] openFiguresDialog</span>
4430 
4431 <span class="comment">% --------------------------------------------------------------------</span>
4432 <a name="_sub106" href="#_subfunctions" class="code">function dialogSelectFigures(hObject,eventdata,handles)</a>
4433 
4434 dialog_params = getappdata(handles.Figure,<span class="string">'dialog_params'</span>);
4435 
4436 idx_selected = get(handles.Figures,<span class="string">'Value'</span>);
4437 fig_names    = get(handles.Figures,<span class="string">'String'</span>);
4438 selected     = fig_names(idx_selected);
4439 dialog_params.selected_figures = selected;
4440 
4441 setappdata(handles.Figure,<span class="string">'dialog_params'</span>,dialog_params)
4442 
4443 
4444 
4445 <span class="comment">% --------------------------------------------------------------------</span>
4446 <a name="_sub107" href="#_subfunctions" class="code">function icons = getIcons</a>
4447 
4448 <span class="comment">% Load data</span>
4449 idx = 1;
4450 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4451     [NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
4452     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   129   120   135   188   NaN   NaN   NaN
4453     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN    96   189   NaN   NaN   130   NaN    95   NaN
4454     NaN   NaN   206   206   206   206   NaN   NaN   NaN   NaN   NaN   NaN   NaN    84    79   NaN
4455     NaN   206   255   255   255   255   198   197   NaN   NaN   NaN   NaN    83    79    76   NaN
4456     198   255   255   255   255   255   255   198   198   198   198   198   198   212   212   NaN
4457     198   255   255   255   255   255   255   255   255   255   255   255   198   157   197   NaN
4458     198   255   226   198   198   198   198   198   198   198   198   198   198   198   177   NaN
4459     198   255   198   218   255   255   255   255   255   255   255   255   255   255   161   NaN
4460     198   253   198   247   255   255   255   255   255   255   255   255   255   251   155   NaN
4461     198   226   201   255   255   255   255   255   255   255   255   255   231   206   165   NaN
4462     198   207   215   255   255   255   255   255   255   255   255   255   239   198   159   NaN
4463     198   198   240   255   255   255   255   255   255   255   255   255   222   157   159   NaN
4464     198   199   255   255   255   255   255   255   255   255   255   255   191   165   159   NaN
4465     NaN   165   165   165   165   165   165   165   165   165   165   165   165   159   159   NaN
4466     NaN   NaN   159   159   159   159   159   159   159   159   159   159   159   159   NaN   NaN]/255;
4467 
4468 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4469     [NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
4470     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   145   137   149   195   NaN   NaN   NaN
4471     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   116   196   NaN   NaN   145   NaN   116   NaN
4472     NaN   NaN   162   162   162   162   NaN   NaN   NaN   NaN   NaN   NaN   NaN   107   105   NaN
4473     NaN   162   255   255   255   255   154   197   NaN   NaN   NaN   NaN   106   104   103   NaN
4474     154   255   255   255   255   255   255   154   154   154   154   154   154   208   208   NaN
4475     154   243   243   243   243   243   243   255   255   255   255   255   154   123   197   NaN
4476     154   235   193   154   154   154   154   154   154   154   154   154   154   154   137   NaN
4477     154   215   154   191   255   255   251   255   255   255   255   255   231   255   126   NaN
4478     154   213   154   240   255   255   255   255   255   255   255   255   199   249   123   NaN
4479     154   179   160   255   247   247   247   247   247   247   247   247   190   188   115   NaN
4480     154   162   184   255   235   235   235   235   235   235   235   231   186   154   169   NaN
4481     154   154   228   255   227   227   227   227   227   227   227   223   178   123   169   NaN
4482     154   156   255   215   215   215   215   215   215   215   215   215   153   115   169   NaN
4483     NaN   115   115   115   115   115   115   115   115   115   115   115   115   169   169   NaN
4484     NaN   NaN   169   169   169   169   169   169   169   169   169   169   169   169   NaN   NaN]/255;
4485 
4486 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4487     [NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN
4488     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   166   161   170   202   NaN   NaN   NaN
4489     NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN   149   205   NaN   NaN   166   NaN   148   NaN
4490     NaN   NaN    34    34    34    34   NaN   NaN   NaN   NaN   NaN   NaN   NaN   141   144   NaN
4491     NaN    34   255   255   255   255    25   197   NaN   NaN   NaN   NaN   142   145   147   NaN
4492     25   255   156   156   156   156   255    25    25    25    25    25    25   200   200   NaN
4493     25   156   140   140   140   140   140   255   255   255   255   255    25    26   197   NaN
4494     25   132    80    25    25    25    25    25    25    25    25    25    25    25    25   NaN
4495     25   132    25   108   255   255   247   255   255   255   255   255   132   255    25   NaN
4496     25   112    25   137   156   156   156   156   156   156   156   156    91   150    25   NaN
4497     25    67    33   165   148   148   148   148   148   148   148   148    83    92    13   NaN
4498     25    38    64   156   132   132   132   132   132   132   132   132    67    25   176   NaN
4499     25    26   122   156   124   124   124   124   124   124   124   124    67    26   176   NaN
4500     25    28   156   108   108   108   108   108   108   108   108   108    41    13   176   NaN
4501     NaN    13    13    13    13    13    13    13    13    13    13    13    13   176   176   NaN
4502     NaN   NaN   176   176   176   176   176   176   176   176   176   176   176   176   NaN   NaN]/255;
4503 
4504 <span class="comment">% Save data</span>
4505 idx = idx+1;
4506 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4507     [NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN
4508     NaN    0.6902    0.6902    0.6902    0.6902    0.6902    0.6274    0.6274    0.5647    0.5647    0.5647    0.5019    0.5019    0.4392    0.2510       NaN
4509     NaN    0.6902    0.7529    0.5647    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.3137    0.3765    0.2510    0.4670
4510     NaN    0.6902    0.7529    0.5647    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.2510    0.1882    0.2510    0.4670
4511     NaN    0.6274    0.7529    0.5019    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.8784    0.1882    0.5019    0.2510    0.4670
4512     NaN    0.6274    0.7529    0.4392    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.8784    0.8157    0.1882    0.4392    0.2510    0.4670
4513     NaN    0.6274    0.7529    0.4392    1.0000    1.0000    1.0000    0.9412    0.9412    0.8784    0.8157    0.7529    0.1255    0.3765    0.2510    0.4670
4514     NaN    0.5647    0.7529    0.3765    1.0000    1.0000    0.9412    0.9412    0.8784    0.8157    0.7529    0.7529    0.0627    0.3765    0.2510    0.4670
4515     NaN    0.5647    0.7529    0.6902    0.3765    0.3137    0.3137    0.2510    0.1882    0.1882    0.1255    0.0627    0.3765    0.3137    0.2510    0.4670
4516     NaN    0.5019    0.6902    0.6902    0.6274    0.5647    0.5019    0.5019    0.5019    0.4392    0.4392    0.3765    0.3137    0.3137    0.2510    0.4670
4517     NaN    0.5019    0.6902    0.6274    0.5647    0.3137    0.3137    0.3137    0.3137    0.3137    0.3765    0.3137    0.3137    0.2510    0.2510    0.4670
4518     NaN    0.4392    0.6274    0.5647    0.5019    0.3137       NaN    0.1882    0.8157    0.8157    0.3765    0.2510    0.2510    0.2510    0.2510    0.4670
4519     NaN    0.4392    0.6274    0.5019    0.5019    0.3137    0.1882    0.4392    0.8784    0.8784    0.4392    0.1882    0.2510    0.1882    0.2510    0.4670
4520     NaN    0.4392    0.5647    0.5019    0.1255    0.1255    0.6902    0.6902    0.7529    0.7529    0.3137    0.1882    0.1882    0.1882    0.2510    0.4670
4521     NaN    0.7333    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.2510    0.4670
4522     NaN       NaN    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670    0.4670];
4523 
4524 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4525     [NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN
4526     NaN    0.7216    0.7216    0.6902    0.6902    0.6588    0.6274    0.5961    0.5647    0.5647    0.5333    0.5019    0.4706    0.4706    0.2196       NaN
4527     NaN    0.6902    0.7529    0.5647    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9725    0.3451    0.3451    0.2196    0.5378
4528     NaN    0.6902    0.7529    0.5333    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9725    0.9412    0.3137    0.1882    0.2196    0.5378
4529     NaN    0.6588    0.7529    0.5019    1.0000    1.0000    1.0000    1.0000    1.0000    0.9725    0.9412    0.9098    0.3137    0.4706    0.2196    0.5378
4530     NaN    0.6274    0.7529    0.4706    1.0000    1.0000    1.0000    1.0000    0.9725    0.9412    0.9098    0.8470    0.2824    0.4392    0.2196    0.5378
4531     NaN    0.5961    0.7529    0.4392    1.0000    1.0000    1.0000    0.9725    0.9412    0.9098    0.8470    0.8157    0.2510    0.4078    0.2196    0.5378
4532     NaN    0.5647    0.7529    0.4078    1.0000    1.0000    0.9725    0.9412    0.9098    0.8470    0.8157    0.7843    0.2196    0.3765    0.2196    0.5378
4533     NaN    0.5333    0.7216    0.7216    0.3765    0.3765    0.3451    0.3137    0.3137    0.2824    0.2510    0.2196    0.3765    0.3451    0.2196    0.5378
4534     NaN    0.5019    0.6902    0.6902    0.6274    0.5647    0.5333    0.5019    0.4706    0.4392    0.4078    0.3765    0.3451    0.3137    0.2196    0.5378
4535     NaN    0.4706    0.6588    0.6274    0.5647    0.3451    0.3451    0.3451    0.3451    0.3765    0.4078    0.3451    0.3137    0.2824    0.2196    0.5378
4536     NaN    0.4706    0.6274    0.5647    0.5333    0.3451       NaN    0.2510    0.8470    0.8784    0.4706    0.2824    0.2824    0.2510    0.2196    0.5378
4537     NaN    0.4392    0.5961    0.5333    0.5019    0.3451    0.2510    0.4706    0.8784    0.9098    0.5019    0.2510    0.2510    0.2510    0.2196    0.5378
4538     NaN    0.4078    0.5647    0.5019    0.2824    0.1882    0.7216    0.7216    0.7529    0.7843    0.3137    0.2510    0.2510    0.2196    0.2196    0.5378
4539     NaN    0.7176    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.2196    0.5378
4540     NaN       NaN    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378    0.5378];
4541 
4542 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4543     [NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN       NaN
4544     NaN    0.9412    0.9412    0.9412    0.9412    0.9412    0.9412    0.8784    0.8784    0.8784    0.8784    0.8784    0.8157    0.8157    0.4392       NaN
4545     NaN    0.9412    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.7529    0.6902    0.4392    0.5997
4546     NaN    0.9412    1.0000    0.9412    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.7529    0.3765    0.4392    0.5997
4547     NaN    0.9412    1.0000    0.8784    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.6902    0.8784    0.4392    0.5997
4548     NaN    0.9412    1.0000    0.8784    1.0000    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.9412    0.6902    0.8157    0.4392    0.5997
4549     NaN    0.8784    1.0000    0.8157    1.0000    1.0000    1.0000    1.0000    0.9412    0.9412    0.9412    0.8784    0.6274    0.8157    0.4392    0.5997
4550     NaN    0.8784    1.0000    0.8157    1.0000    1.0000    1.0000    0.9412    0.9412    0.9412    0.8784    0.8784    0.6274    0.7529    0.4392    0.5997
4551     NaN    0.8784    1.0000    1.0000    0.8157    0.7529    0.7529    0.7529    0.6902    0.6902    0.6274    0.6274    0.7529    0.7529    0.4392    0.5997
4552     NaN    0.8784    1.0000    1.0000    1.0000    0.9412    0.9412    0.8784    0.8784    0.8157    0.8157    0.7529    0.7529    0.6902    0.4392    0.5997
4553     NaN    0.8157    1.0000    1.0000    0.9412    0.4392    0.4392    0.4392    0.4392    0.4392    0.5019    0.7529    0.6902    0.6902    0.4392    0.5997
4554     NaN    0.8157    1.0000    0.9412    0.9412    0.4392       NaN    0.2510    0.9412    0.9412    0.5019    0.6902    0.6902    0.6274    0.4392    0.5997
4555     NaN    0.8157    1.0000    0.9412    0.8784    0.4392    0.2510    0.5647    0.9412    0.9412    0.5647    0.6274    0.6274    0.6274    0.4392    0.5997
4556     NaN    0.8157    0.9412    0.8784    0.6902    0.2510    0.7529    0.7529    0.8157    0.8157    0.3137    0.6274    0.6274    0.6274    0.4392    0.5997
4557     NaN    0.8275    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.4392    0.5997
4558     NaN       NaN    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997    0.5997];
4559 
4560 <span class="comment">% Plotting parameters</span>
4561 idx = idx+1;
4562 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4563     [  0     0     0     0     0     0     0     0     0     0     0     0     0     0     0   255
4564     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4565     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   165
4566     0   255   203    79   213   255   255   255   255   255   254   160   109   247     0   165
4567     0   254    71   224    79   255   255   255   255   255   211   101   165   123     0   165
4568     0   191   123   255   123   203   255   255   255   255   101   224   254    79     0   165
4569     0   101   239   255   224   109   255   255   255   247    79   254   254   123    36   165
4570     0   123   254   255   255    79   247   255   255   165   165   255   255   224     0   165
4571     0   255   255   255   254   160   173   255   255    87   239   255   255   255     0   165
4572     0   255   255   255   255   224   101   255   239    87   255   255   255   255     0   165
4573     0   255   255   255   255   255   101   224   123   191   255   255   255   255     0   165
4574     0   255   255   255   255   254   224    54   101   255   255   255   255   255     0   165
4575     0   255   255   255   255   255   255   247   255   255   255   255   255   255     0   165
4576     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   165
4577     0     0     0     1     0     0     0     0     0     0     0     0     0     0     0   165
4578     255   165   165   165   172   165   165   165   165   165   165   165   165   165   165   165]/255;
4579 
4580 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4581     [  0     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0
4582     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0     0
4583     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   165
4584     0   255   203    79   213   255   255   255   255   255   254   160   109   247     0   165
4585     0   254    71   224    79   255   255   255   255   255   211   101   165   123     0   165
4586     0   191   123   255   123   203   255   255   255   255   101   224   254    79     0   165
4587     0   101   239   255   224   109   255   255   255   247    79   254   254   123     0   165
4588     0   123   254   255   255    79   247   255   255   165   165   255   255   224     0   165
4589     0   255   255   255   254   160   173   255   255    87   239   255   255   255     0   165
4590     0   255   255   255   255   224   101   255   239    87   255   255   255   255     0   165
4591     0   255   255   255   255   255   101   224   123   191   255   255   255   255     0   165
4592     0   255   255   255   255   254   224    54   101   255   255   255   255   255     0   165
4593     0   255   255   255   255   255   255   247   255   255   255   255   255   255     0   165
4594     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   165
4595     0     0     0     0     0     0     0     0     0     0     0     0     0     0     0   165
4596     0   165   165   165   153   165   165   165   165   165   165   165   165   165   165   165]/255;
4597 
4598 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4599     [  0     0     0     0     0     0     0     0     0     0     0     0     0     0     0   255
4600     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4601     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4602     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4603     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4604     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4605     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4606     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4607     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4608     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4609     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4610     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4611     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4612     0   255   255   255   255   255   255   255   255   255   255   255   255   255     0   145
4613     0    24    39     0     0     0     0     0     0     0     0     0     0     0     0   145
4614     255   145   145   145   134   145   145   145   145   145   145   145   145   145   145   145]/255;
4615 
4616 <span class="comment">% Processing parameters</span>
4617 idx = idx+1;
4618 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4619     [255   255   255   255   255   255   255   255   255   255   255   255   255   255   255   255
4620     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255
4621     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4622     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4623     255     0   255   255   107   255   255   107   255   255   107   255   107   255     0   255
4624     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4625     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4626     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4627     255     0   255   255   107   255   107   255   107   255   255   107   255   255     0   255
4628     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4629     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4630     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4631     255     0   255   107   255   107   255   107   255   255   107   255   107   255     0   255
4632     255     0   255   255   107   255   255   107   255   255   255   107   255   255     0   255
4633     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4634     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255]/255;
4635 
4636 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4637     [255   255   255   255   255   255   255   255   255   255   255   255   255   255   255   255
4638     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255
4639     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4640     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4641     255     0   255   255    99   255   255    99   255   255    99   255    99   255     0   255
4642     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4643     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4644     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4645     255     0   255   255    99   255    99   255    99   255   255    99   255   255     0   255
4646     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4647     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4648     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4649     255     0   255    99   255    99   255    99   255   255    99   255    99   255     0   255
4650     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4651     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4652     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255]/255;
4653 
4654 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4655     [255   255   255   255   255   255   255   255   255   255   255   255   255   255   255   255
4656     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255
4657     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4658     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4659     255     0   255   255    99   255   255    99   255   255    99   255    99   255     0   255
4660     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4661     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4662     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4663     255     0   255   255    99   255    99   255    99   255   255    99   255   255     0   255
4664     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4665     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4666     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4667     255     0   255    99   255    99   255    99   255   255    99   255    99   255     0   255
4668     255     0   255   255    99   255   255    99   255   255   255    99   255   255     0   255
4669     255     0   255   255   255   255   255   255   255   255   255   255   255   255     0   255
4670     255     0     0     0   255   255   255   255   255   255   255   255     0     0     0   255]/255;
4671 
4672 <span class="comment">% Export bathymetry dialog</span>
4673 idx = idx+1;
4674 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4675     [226    226    226    226    226    226    226    197    220    226    226    226    226    226    226    226
4676     226    226    226    226    226    227    241    144    158    241    228    228    229    228    229    226
4677     226    243    243    243    237    237    246    164    119    242    232    225    226    218    243    206
4678     179    152    153    166    148    148    177    179    63    185    141    146    154    151    179    189
4679     167    4    134    175    151    164    161    198    122    255    212    233    215    199    140    185
4680     134    50    209    241    255    255    133    118    15    20    28    94    4    0    0    89
4681     136    0    0    0    0    0    0    0    0    0    0    0    0    21    56    140
4682     208    255    226    233    255    242    215    232    251    237    226    233    207    222    156    139
4683     172    159    152    153    166    145    178    147    169    164    161    163    154    153    128    135
4684     160    164    148    139    171    150    165    154    165    185    166    173    190    190    148    162
4685     214    233    211    203    217    212    217    238    202    236    213    222    230    224    184    184
4686     219    206    174    190    219    204    201    218    183    224    219    222    217    202    176    182
4687     210    182    183    214    225    220    203    229    175    217    220    220    222    212    184    185
4688     197    175    207    224    223    220    205    231    170    221    220    220    222    217    191    187
4689     186    193    223    224    220    201    203    228    171    224    218    220    222    215    190    187
4690     189    211    220    216    204    201    214    213    187    213    216    220    220    212    193    189
4691     ]/255;
4692 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4693     [233    233    233    233    233    233    233    204    227    233    233    233    233    233    233    233
4694     233    233    233    233    233    234    247    152    167    247    235    234    235    234    236    233
4695     233    242    242    240    236    237    247    170    131    243    234    231    234    224    245    212
4696     208    193    199    209    196    196    211    197    100    211    194    196    200    199    202    196
4697     205    19    179    199    183    197    182    179    162    255    217    246    234    231    191    199
4698     167    47    229    240    255    252    139    154    87    86    99    139    79    46    23    121
4699     175    30    47    29    28    19    5    41    33    39    54    55    65    83    81    185
4700     236    255    249    253    255    251    240    255    235    255    247    252    233    245    204    190
4701     208    200    195    196    204    192    214    202    144    215    201    201    195    195    177    186
4702     200    201    189    183    206    192    204    210    111    231    209    214    222    223    199    209
4703     245    255    251    247    254    254    252    255    156    255    254    255    255    254    235    232
4704     249    244    227    237    247    244    242    255    132    239    254    250    247    244    228    231
4705     245    231    231    246    253    249    243    255    119    223    255    251    250    245    229    232
4706     239    227    244    251    251    248    244    255    110    217    255    250    251    246    233    233
4707     233    237    250    252    249    242    246    255    115    209    255    250    251    246    232    232
4708     234    245    249    247    242    242    246    231    154    192    246    249    249    245    234    233
4709     ]/255;
4710 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4711     [233    233    233    233    233    233    233    204    227    233    233    233    233    233    233    233
4712     233    233    233    233    233    234    247    152    167    247    235    234    235    234    236    233
4713     233    242    242    240    236    237    247    170    131    243    234    231    234    224    245    212
4714     208    193    199    209    196    196    211    197    100    211    194    196    200    199    202    196
4715     205    19    179    199    183    197    182    179    162    255    217    246    234    231    191    199
4716     167    47    229    240    255    252    139    154    87    86    99    139    79    46    23    121
4717     175    30    47    29    28    19    5    41    33    39    54    55    65    83    81    185
4718     236    255    249    253    255    251    240    255    235    255    247    252    233    245    204    190
4719     208    200    195    196    204    192    214    202    144    215    201    201    195    195    177    186
4720     200    201    189    183    206    192    204    210    111    231    209    214    222    223    199    209
4721     245    255    251    247    254    254    252    255    156    255    254    255    255    254    235    232
4722     249    244    227    237    247    244    242    255    132    239    254    250    247    244    228    231
4723     245    231    231    246    253    249    243    255    119    223    255    251    250    245    229    232
4724     239    227    244    251    251    248    244    255    110    217    255    250    251    246    233    233
4725     233    237    250    252    249    242    246    255    115    209    255    250    251    246    232    232
4726     234    245    249    247    242    242    246    231    154    192    246    249    249    245    234    233
4727     ]/255;
4728 
4729 <span class="comment">% Export Figures Dialog</span>
4730 idx = idx + 1;
4731 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4732     [NaN    NaN    10    23    23    23    23    23    23    23    21    3    NaN    NaN    NaN    NaN
4733     NaN    NaN    67    255    255    255    255    255    255    255    201    141    NaN    NaN    NaN    NaN
4734     NaN    NaN    43    255    241    240    241    246    252    255    186    220    151    NaN    NaN    NaN
4735     NaN    NaN    42    255    238    237    237    236    238    254    210    178    214    38    NaN    NaN
4736     NaN    NaN    43    255    241    241    241    241    240    244    252    255    255    79    NaN    NaN
4737     NaN    NaN    47    255    232    232    225    224    224    223    220    238    255    69    NaN    NaN
4738     NaN    NaN    55    233    114    225    230    223    221    221    215    237    255    67    NaN    NaN
4739     4    NaN    37    181    168    126    193    214    205    200    203    242    255    67    NaN    NaN
4740     41    164    134    153    144    139    131    209    238    223    242    240    255    67    NaN    NaN
4741     41    118    91    91    122    125    120    106    170    241    245    241    255    67    NaN    NaN
4742     41    113    91    89    97    108    99    89    117    205    190    230    255    67    NaN    NaN
4743     41    124    94    88    78    74    81    179    255    252    244    241    255    67    NaN    NaN
4744     13    34    76    187    88    92    222    255    255    250    250    250    255    73    NaN    NaN
4745     NaN    NaN    69    236    121    227    255    243    238    238    238    238    255    82    NaN    NaN
4746     NaN    NaN    NaN    0    0    0    0    0    0    0    0    0    0    0    NaN    NaN]/255;
4747 
4748 
4749 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4750     [NaN    NaN    10    24    24    24    24    24    24    24    22    4    NaN    NaN    NaN    NaN
4751     NaN    NaN    69    255    255    255    255    255    255    255    204    144    NaN    NaN    NaN    NaN
4752     NaN    NaN    45    255    241    240    241    246    252    255    189    222    155    NaN    NaN    NaN
4753     NaN    NaN    43    255    238    237    237    236    238    254    210    179    215    39    NaN    NaN
4754     NaN    NaN    44    255    241    241    241    241    240    244    252    255    255    80    NaN    NaN
4755     NaN    NaN    49    255    231    230    225    224    224    223    220    238    255    70    NaN    NaN
4756     NaN    NaN    56    227    136    214    227    223    221    221    215    237    255    68    NaN    NaN
4757     4    NaN    19    157    243    154    181    210    204    200    203    242    255    67    NaN    NaN
4758     51    255    231    225    219    217    172    197    232    222    242    240    255    67    NaN    NaN
4759     52    227    184    183    195    201    204    172    169    239    245    241    255    67    NaN    NaN
4760     51    218    177    177    180    187    187    177    130    202    190    230    255    67    NaN    NaN
4761     51    237    195    183    172    170    152    175    255    251    244    241    255    67    NaN    NaN
4762     15    38    72    173    183    149    211    255    255    250    250    250    255    73    NaN    NaN
4763     NaN    NaN    65    226    174    214    252    242    238    238    238    238    255    84    NaN    NaN
4764     NaN    NaN    NaN    0    0    0    0    0    0    0    0    0    0    0    NaN    NaN]/255;
4765 
4766 
4767 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4768     [NaN    NaN    9    23    23    23    23    23    23    23    21    3    NaN    NaN    NaN    NaN
4769     NaN    NaN    66    255    255    255    255    255    255    255    196    139    NaN    NaN    NaN    NaN
4770     NaN    NaN    42    255    239    238    238    244    252    255    186    216    148    NaN    NaN    NaN
4771     NaN    NaN    41    255    236    235    235    234    237    251    210    176    212    36    NaN    NaN
4772     NaN    NaN    42    255    239    239    239    239    238    241    252    255    255    78    NaN    NaN
4773     NaN    NaN    46    255    233    232    224    223    223    223    219    235    255    67    NaN    NaN
4774     NaN    NaN    53    240    101    232    230    221    219    218    213    235    255    65    NaN    NaN
4775     5    NaN    60    212    94    107    205    215    203    198    201    240    255    66    NaN    NaN
4776     34    56    40    80    70    62    94    222    241    221    240    238    255    66    NaN    NaN
4777     35    10    2    0    51    55    36    46    176    240    243    239    255    66    NaN    NaN
4778     35    11    9    7    16    34    12    6    110    204    188    228    255    66    NaN    NaN
4779     35    14    0    0    0    0    14    187    255    251    242    239    255    66    NaN    NaN
4780     12    37    84    206    0    41    234    255    255    248    248    248    255    72    NaN    NaN
4781     NaN    NaN    69    249    79    239    255    240    236    236    236    236    255    80    NaN    NaN
4782     NaN    NaN    NaN    0    0    0    0    0    0    0    0    0    0    0    NaN    NaN]/255;
4783 
4784 <span class="comment">% Export Excel File</span>
4785 idx = idx + 1;
4786 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4787     [NaN    NaN    NaN    NaN    NaN    NaN  106  252  255  255  255  255  255  255  255  255
4788    38  136  109  101   96   77   95  134  106   99   93   87   90   66  255  255
4789    52  197  232  217  210  202  191  178  170  164  160  159  155   15  255  255
4790    51  181  255  255  255  255  255  255  255  255  255  255  253    9  255  255
4791    49  174  245  153  156  175  255  255  181  153  149  205  245    0  255  255
4792    47  168  199  122  149  100  155  183   99   99   15  117  245    0  255  241
4793    45  158  255  146  146  141   87   68  120   34   86  255  238    0  252  232
4794    42  144  255  255  158  158  143   74   68  117  255  255  230    0  255  255
4795    40  134  255  255  169   15  150  111   68   81  105  167  236    0  230  217
4796    37  131  255  158   99  106   10  143  117   50   51  165  252    0  255  254
4797    35  122  208    0   22   32    8   17  110   20    0   13  212    0  255  245
4798    33  115  255  255  255  255  255  250  146  113  119  106  217    0  236  217
4799    31  109  255  254  252  251  250  255  255  255  255  255  241    0  255  251
4800    29  116  190  168  164  157  145  133  126  121  117  118  112    0  215  205
4801    20   63   47   38   36   20   38   83   64   51   52   55   64   20  255  241
4802     NaN    NaN    NaN    NaN    NaN    NaN   96  249  252  228  237  251  249  203  241  246]/255;
4803 
4804 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4805     [NaN    NaN    NaN    NaN    NaN    NaN  114  252  255  255  255  255  255  255  255  255
4806    49  180  152  145  140  118  140  173  150  139  132  126  126  106  255  255
4807    67  249  252  242  237  231  221  207  201  196  194  193  193   75  255  255
4808    66  232  255  255  255  255  255  255  255  255  255  255  255   68  255  255
4809    64  226  251  197  191  200  255  255  194  170  168  214  253   61  255  255
4810    62  220  224  183  207  173  189  202  167  175  116  172  253   58  255  246
4811    60  211  255  190  196  203  166  131  187  134  148  255  249   54  254  240
4812    57  199  255  255  198  203  202  158  132  168  255  255  245   47  255  255
4813    54  190  255  255  200  110  199  185  155  147  160  203  251   44  240  230
4814    52  187  255  204  187  194  121  204  189  139   99  179  255   39  255  254
4815    49  180  230   42   49   53   36   64  182   98   65   70  228   36  255  248
4816    47  171  255  255  255  255  255  255  186  115  124  114  235   34  243  229
4817    45  166  255  255  254  254  255  255  255  255  255  255  255   33  255  252
4818    43  176  222  206  204  200  190  180  174  171  169  169  169   32  229  220
4819    30  101   81   74   69   54   72  116   96   84   84   84   94   55  255  245
4820     NaN    NaN    NaN    NaN    NaN    NaN  105  251  253  237  242  252  251  218  246  249]/255;
4821 
4822 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4823     [ NaN    NaN    NaN    NaN    NaN    NaN  125  253  255  255  255  255  255  255  255  255
4824    34  118   92   84   79   56   83  111   88   79   73   69   74   45  255  255
4825    46  180  228  207  203  195  182  169  159  155  149  149  145    0  255  255
4826    45  163  255  255  255  255  255  255  255  255  255  255  254    0  255  255
4827    42  156  248  152  155  176  255  255  181  154  147  206  245    0  255  255
4828    40  150  202  117  136   87  154  181   90   84    8  120  243    0  255  252
4829    38  138  255  145  137  131   81   65  106   27   86  255  238    0  255  250
4830    35  122  255  255  159  152  137   75   62  121  255  255  229    0  255  255
4831    33  113  255  255  171   13  145  111   67   76   84  159  234    0  255  247
4832    30  109  255  160   89   97   10  136  111   36   33  159  251    0  255  255
4833    28   99  211    0   12   23    2   11  101    0    0   13  209    0  255  253
4834    26   92  255  255  255  255  255  250  146  111  117  104  213    0  255  245
4835    23   89  255  255  255  255  255  255  255  255  255  255  241    0  255  254
4836    22   93  180  156  151  141  129  114  105   98   93   93   83    0  255  239
4837    15   43   26   17   15    0   25   63   45   39   38   39   44    9  255  252
4838     NaN    NaN    NaN    NaN    NaN    NaN  117  253  255  249  251  255  254  239  252  254]/255;
4839 
4840 <span class="comment">% Zoom In</span>
4841 idx = idx + 1;
4842 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4843     [NaN,NaN,0.745082780193790,0.603906309605554,0.603906309605554,0.603906309605554,0.603906309605554,0.568627450980392,0.764705882352941,NaN,NaN,NaN,NaN,NaN,NaN,NaN;NaN,0.698023956664378,0.568627450980392,0.780392156862745,0.823514152742809,0.854886701762417,0.925474937056535,0.827450980392157,0.596063172350652,0.749019607843137,NaN,NaN,NaN,NaN,NaN,NaN;0.752925917448692,0.501945525291829,0.737239642938888,0.643121995880064,0.584313725490196,0.690180819409476,0.760769054703594,1,0.894102388036927,0.596063172350652,NaN,NaN,NaN,NaN,NaN,NaN;0.682337682154574,0.639215686274510,0.650965133134966,0.600000000000000,0.596063172350652,0.196078431372549,0.596063172350652,0.764705882352941,0.941161211566339,0.721553368429084,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.686274509803922,0.678431372549020,0.682337682154574,0.662745098039216,0.196078431372549,0.650965133134966,0.639215686274510,0.788235294117647,0.811764705882353,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.764705882352941,0.815671015487907,0.196078431372549,0.196078431372549,0.196078431372549,0.196078431372549,0.196078431372549,0.682337682154574,0.815671015487907,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.866666666666667,0.952941176470588,0.803921568627451,0.803921568627451,0.196078431372549,0.619592584115358,0.607843137254902,0.737239642938888,0.741176470588235,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.682337682154574,0.721553368429084,1,1,0.968627450980392,0.196078431372549,0.709803921568628,0.670588235294118,0.807827878233005,0.564690623331045,0.772549019607843,NaN,NaN,NaN,NaN,NaN;NaN,0.592156862745098,0.839200427252613,1,1,0.901945525291829,0.788235294117647,0.792141603723201,0.549004348821241,0.654901960784314,NaN,1,NaN,NaN,NaN,NaN;NaN,NaN,0.639215686274510,0.698023956664378,0.827450980392157,0.784298466468299,0.650965133134966,0.498054474708171,0.623529411764706,0.627435721370260,0.890196078431373,0.937254901960784,0.996063172350652,NaN,NaN,NaN;NaN,NaN,NaN,0.772549019607843,0.698023956664378,0.678431372549020,0.690180819409476,0.784298466468299,0.666651407644770,0.615686274509804,0.745082780193790,1,0.933318074311437,0.996063172350652,NaN,NaN;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.705867093919280,0.517631799801633,0.745082780193790,1,0.929411764705882,1,NaN;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.701960784313725,0.513725490196078,0.741176470588235,1,0.925474937056535,0.749019607843137;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.705867093919280,0.513725490196078,0.741176470588235,0.988220035095750,0.745082780193790;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.701960784313725,0.533318074311437,0.549004348821241,0.654901960784314;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.694117647058824,0.635278858625162,NaN;];
4844 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4845     [1,1,0.745082780193790,0.670588235294118,0.670588235294118,0.670588235294118,0.670588235294118,0.576470588235294,0.760769054703594,1,1,1,1,1,1,1;1,0.701960784313725,0.650965133134966,0.917631799801633,0.968627450980392,0.992156862745098,1,0.898039215686275,0.603906309605554,0.741176470588235,1,1,1,1,1,1;0.756862745098039,0.588220035095750,0.929411764705882,0.858823529411765,0.807827878233005,0.854886701762417,0.894102388036927,1,0.976470588235294,0.596063172350652,1,1,1,1,1,1;0.721553368429084,0.823514152742809,0.878416113527123,0.835294117647059,0.831357289997711,0.274509803921569,0.815671015487907,0.894102388036927,1,0.807827878233005,0.670588235294118,1,1,1,1,1;0.670588235294118,0.901945525291829,0.890196078431373,0.890196078431373,0.878416113527123,0.274509803921569,0.854886701762417,0.831357289997711,0.937254901960784,0.933318074311437,0.670588235294118,1,1,1,1,1;0.670588235294118,0.937254901960784,0.937254901960784,0.274509803921569,0.274509803921569,0.274509803921569,0.274509803921569,0.274509803921569,0.878416113527123,0.937254901960784,0.670588235294118,1,1,1,1,1;0.670588235294118,0.937254901960784,0.988220035095750,0.862729839017319,0.862729839017319,0.274509803921569,0.815671015487907,0.803921568627451,0.921568627450980,0.854886701762417,0.670588235294118,1,1,1,1,1;0.721553368429084,0.737239642938888,1,1,0.988220035095750,0.274509803921569,0.898039215686275,0.882352941176471,0.980376897840848,0.627435721370260,0.768612191958496,1,1,1,1,1;1,0.603906309605554,0.847043564507515,1,1,0.984313725490196,0.960784313725490,0.976470588235294,0.662745098039216,0.658808270389868,1,0.615686274509804,1,1,1,1;1,1,0.650965133134966,0.701960784313725,0.854886701762417,0.874509803921569,0.780392156862745,0.564690623331045,0.615686274509804,0.627435721370260,0.733333333333333,0.713710231174182,0.600000000000000,1,1,1;1,1,1,0.772549019607843,0.705867093919280,0.686274509803922,0.694117647058824,0.784298466468299,0.674494544899672,0.572533760585946,0.498054474708171,0.741176470588235,0.709803921568628,0.600000000000000,1,1;1,1,1,1,1,1,1,1,1,0.701960784313725,0.439215686274510,0.509788662546731,0.741176470588235,0.709803921568628,0.600000000000000,1;1,1,1,1,1,1,1,1,1,1,0.701960784313725,0.439215686274510,0.505882352941176,0.741176470588235,0.721553368429084,0.501945525291829;1,1,1,1,1,1,1,1,1,1,1,0.705867093919280,0.443152513923857,0.505882352941176,0.733333333333333,0.670588235294118;1,1,1,1,1,1,1,1,1,1,1,1,0.705867093919280,0.454901960784314,0.435309376668956,0.658808270389868;1,1,1,1,1,1,1,1,1,1,1,1,1,0.694117647058824,0.647058823529412,1;];
4846 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4847     [1,1,0.796078431372549,0.854886701762417,0.854886701762417,0.854886701762417,0.854886701762417,0.713710231174182,0.792141603723201,1,1,1,1,1,1,1;1,0.768612191958496,0.827450980392157,0.956847486076143,0.976470588235294,0.992156862745098,1,0.945098039215686,0.803921568627451,0.796078431372549,1,1,1,1,1,1;0.776455329213397,0.749019607843137,0.952941176470588,0.901945525291829,0.882352941176471,0.909788662546731,0.937254901960784,1,0.988220035095750,0.819607843137255,1,1,1,1,1,1;0.858823529411765,0.882352941176471,0.909788662546731,0.882352941176471,0.886259250782025,0.470588235294118,0.882352941176471,0.933318074311437,1,0.921568627450980,0.854886701762417,1,1,1,1,1;0.854886701762417,0.925474937056535,0.909788662546731,0.913725490196078,0.905882352941177,0.470588235294118,0.901945525291829,0.894102388036927,0.960784313725490,0.968627450980392,0.854886701762417,1,1,1,1,1;0.854886701762417,0.945098039215686,0.949004348821241,0.470588235294118,0.470588235294118,0.470588235294118,0.470588235294118,0.470588235294118,0.921568627450980,0.968627450980392,0.854886701762417,1,1,1,1,1;0.854886701762417,0.952941176470588,0.992156862745098,0.917631799801633,0.917631799801633,0.470588235294118,0.945098039215686,0.949004348821241,0.941161211566339,0.937254901960784,0.854886701762417,1,1,1,1,1;0.858823529411765,0.827450980392157,1,1,0.992156862745098,0.470588235294118,0.921568627450980,0.909788662546731,0.980376897840848,0.823514152742809,0.792141603723201,1,1,1,1,1;1,0.717647058823529,0.925474937056535,1,1,0.980376897840848,0.960784313725490,0.976470588235294,0.815671015487907,0.776455329213397,1,0.180392156862745,1,1,1,1;1,1,0.776455329213397,0.870572976272221,0.941161211566339,0.937254901960784,0.866666666666667,0.717647058823529,0.682337682154574,0.607843137254902,0.490211337453269,0.435309376668956,0.203921568627451,1,1,1;1,1,1,0.799984740978103,0.796078431372549,0.792141603723201,0.764705882352941,0.792141603723201,0.780392156862745,0.545098039215686,0.125490196078431,0.325505455100328,0.450995651178759,0.203921568627451,1,1;1,1,1,1,1,1,1,1,1,0.784298466468299,0.384313725490196,0.149019607843137,0.325505455100328,0.458838788433661,0.180392156862745,1;1,1,1,1,1,1,1,1,1,1,0.796078431372549,0.396093690394446,0.149019607843137,0.329411764705882,0.458838788433661,0.254917219806210;1,1,1,1,1,1,1,1,1,1,1,0.803921568627451,0.407843137254902,0.149019607843137,0.298039215686275,0.580376897840848;1,1,1,1,1,1,1,1,1,1,1,1,0.803921568627451,0.403936827649348,0.258823529411765,0.674494544899672;1,1,1,1,1,1,1,1,1,1,1,1,1,0.749019607843137,0.654901960784314,1;];
4848 
4849 <span class="comment">% Zoom Out</span>
4850 idx = idx + 1;
4851 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4852     [NaN,NaN,0.745082780193790,0.603906309605554,0.603906309605554,0.603906309605554,0.603906309605554,0.568627450980392,0.764705882352941,NaN,NaN,NaN,NaN,NaN,NaN,NaN;NaN,0.698023956664378,0.568627450980392,0.780392156862745,0.823514152742809,0.854886701762417,0.925474937056535,0.827450980392157,0.596063172350652,0.749019607843137,NaN,NaN,NaN,NaN,NaN,NaN;0.752925917448692,0.501945525291829,0.737239642938888,0.643121995880064,0.584313725490196,0.690180819409476,0.760769054703594,1,0.894102388036927,0.596063172350652,NaN,NaN,NaN,NaN,NaN,NaN;0.682337682154574,0.639215686274510,0.650965133134966,0.600000000000000,0.596063172350652,0.643121995880064,0.596063172350652,0.764705882352941,0.941161211566339,0.721553368429084,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.686274509803922,0.678431372549020,0.682337682154574,0.662745098039216,0.650965133134966,0.650965133134966,0.639215686274510,0.788235294117647,0.811764705882353,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.764705882352941,0.815671015487907,0.196078431372549,0.196078431372549,0.196078431372549,0.196078431372549,0.196078431372549,0.682337682154574,0.815671015487907,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.603906309605554,0.866666666666667,0.952941176470588,0.760769054703594,0.760769054703594,0.760769054703594,0.760769054703594,0.760769054703594,0.737239642938888,0.741176470588235,0.603906309605554,NaN,NaN,NaN,NaN,NaN;0.682337682154574,0.721553368429084,1,1,0.968627450980392,0.870572976272221,0.709803921568628,0.670588235294118,0.807827878233005,0.564690623331045,0.772549019607843,NaN,NaN,NaN,NaN,NaN;NaN,0.592156862745098,0.839200427252613,1,1,0.901945525291829,0.788235294117647,0.792141603723201,0.549004348821241,0.654901960784314,NaN,NaN,NaN,NaN,NaN,NaN;NaN,NaN,0.639215686274510,0.698023956664378,0.827450980392157,0.784298466468299,0.650965133134966,0.498054474708171,0.623529411764706,0.627435721370260,0.890196078431373,0.937254901960784,0.996063172350652,NaN,NaN,NaN;NaN,NaN,NaN,0.772549019607843,0.698023956664378,0.678431372549020,0.690180819409476,0.784298466468299,NaN,0.615686274509804,0.745082780193790,1,0.933318074311437,0.996063172350652,NaN,NaN;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.705867093919280,0.517631799801633,0.745082780193790,1,0.929411764705882,1,NaN;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.701960784313725,0.513725490196078,0.741176470588235,1,0.925474937056535,0.749019607843137;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.705867093919280,0.513725490196078,0.741176470588235,0.988220035095750,0.745082780193790;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.701960784313725,0.533318074311437,0.549004348821241,0.654901960784314;NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.694117647058824,0.635278858625162,NaN;];
4853 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4854     [1,1,0.745082780193790,0.670588235294118,0.670588235294118,0.670588235294118,0.670588235294118,0.576470588235294,0.760769054703594,1,1,1,1,1,1,1;1,0.701960784313725,0.650965133134966,0.917631799801633,0.968627450980392,0.992156862745098,1,0.898039215686275,0.603906309605554,0.741176470588235,1,1,1,1,1,1;0.756862745098039,0.588220035095750,0.929411764705882,0.858823529411765,0.807827878233005,0.854886701762417,0.894102388036927,1,0.976470588235294,0.596063172350652,1,1,1,1,1,1;0.721553368429084,0.823514152742809,0.878416113527123,0.835294117647059,0.831357289997711,0.843137254901961,0.815671015487907,0.894102388036927,1,0.807827878233005,0.670588235294118,1,1,1,1,1;0.670588235294118,0.901945525291829,0.890196078431373,0.890196078431373,0.878416113527123,0.870572976272221,0.854886701762417,0.831357289997711,0.937254901960784,0.933318074311437,0.670588235294118,1,1,1,1,1;0.670588235294118,0.937254901960784,0.937254901960784,0.274509803921569,0.274509803921569,0.274509803921569,0.274509803921569,0.274509803921569,0.878416113527123,0.937254901960784,0.670588235294118,1,1,1,1,1;0.670588235294118,0.937254901960784,0.988220035095750,0.819607843137255,0.819607843137255,0.819607843137255,0.819607843137255,0.819607843137255,0.921568627450980,0.854886701762417,0.670588235294118,1,1,1,1,1;0.721553368429084,0.737239642938888,1,1,0.988220035095750,0.952941176470588,0.898039215686275,0.882352941176471,0.980376897840848,0.627435721370260,0.768612191958496,1,1,1,1,1;1,0.603906309605554,0.847043564507515,1,1,0.984313725490196,0.960784313725490,0.976470588235294,0.662745098039216,0.658808270389868,1,1,1,1,1,1;1,1,0.650965133134966,0.701960784313725,0.854886701762417,0.874509803921569,0.780392156862745,0.564690623331045,0.615686274509804,0.627435721370260,0.733333333333333,0.713710231174182,0.600000000000000,1,1,1;1,1,1,0.772549019607843,0.705867093919280,0.686274509803922,0.694117647058824,0.784298466468299,1,0.572533760585946,0.498054474708171,0.741176470588235,0.709803921568628,0.600000000000000,1,1;1,1,1,1,1,1,1,1,1,0.701960784313725,0.439215686274510,0.509788662546731,0.741176470588235,0.709803921568628,0.600000000000000,1;1,1,1,1,1,1,1,1,1,1,0.701960784313725,0.439215686274510,0.505882352941176,0.741176470588235,0.721553368429084,0.501945525291829;1,1,1,1,1,1,1,1,1,1,1,0.705867093919280,0.443152513923857,0.505882352941176,0.733333333333333,0.670588235294118;1,1,1,1,1,1,1,1,1,1,1,1,0.705867093919280,0.454901960784314,0.435309376668956,0.658808270389868;1,1,1,1,1,1,1,1,1,1,1,1,1,0.694117647058824,0.647058823529412,1;];
4855 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4856     [1,1,0.796078431372549,0.854886701762417,0.854886701762417,0.854886701762417,0.854886701762417,0.713710231174182,0.792141603723201,1,1,1,1,1,1,1;1,0.768612191958496,0.827450980392157,0.956847486076143,0.976470588235294,0.992156862745098,1,0.945098039215686,0.803921568627451,0.796078431372549,1,1,1,1,1,1;0.776455329213397,0.749019607843137,0.952941176470588,0.901945525291829,0.882352941176471,0.909788662546731,0.937254901960784,1,0.988220035095750,0.819607843137255,1,1,1,1,1,1;0.858823529411765,0.882352941176471,0.909788662546731,0.882352941176471,0.886259250782025,0.894102388036927,0.882352941176471,0.933318074311437,1,0.921568627450980,0.854886701762417,1,1,1,1,1;0.854886701762417,0.925474937056535,0.909788662546731,0.913725490196078,0.905882352941177,0.901945525291829,0.901945525291829,0.894102388036927,0.960784313725490,0.968627450980392,0.854886701762417,1,1,1,1,1;0.854886701762417,0.945098039215686,0.949004348821241,0.470588235294118,0.470588235294118,0.470588235294118,0.470588235294118,0.470588235294118,0.921568627450980,0.968627450980392,0.854886701762417,1,1,1,1,1;0.854886701762417,0.952941176470588,0.992156862745098,0.890196078431373,0.890196078431373,0.890196078431373,0.890196078431373,0.890196078431373,0.941161211566339,0.937254901960784,0.854886701762417,1,1,1,1,1;0.858823529411765,0.827450980392157,1,1,0.992156862745098,0.964690623331045,0.921568627450980,0.909788662546731,0.980376897840848,0.823514152742809,0.792141603723201,1,1,1,1,1;1,0.717647058823529,0.925474937056535,1,1,0.980376897840848,0.960784313725490,0.976470588235294,0.815671015487907,0.776455329213397,1,1,1,1,1,1;1,1,0.776455329213397,0.870572976272221,0.941161211566339,0.937254901960784,0.866666666666667,0.717647058823529,0.682337682154574,0.607843137254902,0.490211337453269,0.435309376668956,0.203921568627451,1,1,1;1,1,1,0.799984740978103,0.796078431372549,0.792141603723201,0.764705882352941,0.792141603723201,1,0.545098039215686,0.125490196078431,0.325505455100328,0.450995651178759,0.203921568627451,1,1;1,1,1,1,1,1,1,1,1,0.784298466468299,0.384313725490196,0.149019607843137,0.325505455100328,0.458838788433661,0.180392156862745,1;1,1,1,1,1,1,1,1,1,1,0.796078431372549,0.396093690394446,0.149019607843137,0.329411764705882,0.458838788433661,0.254917219806210;1,1,1,1,1,1,1,1,1,1,1,0.803921568627451,0.407843137254902,0.149019607843137,0.298039215686275,0.580376897840848;1,1,1,1,1,1,1,1,1,1,1,1,0.803921568627451,0.403936827649348,0.258823529411765,0.674494544899672;1,1,1,1,1,1,1,1,1,1,1,1,1,0.749019607843137,0.654901960784314,1;];
4857 
4858 <span class="comment">% Pan</span>
4859 idx = idx + 1;
4860 icons(idx).data(:,:,1) = <span class="keyword">...</span>
4861     [NaN,NaN,NaN,NaN,NaN,NaN,NaN,0.290196078431373,0.290196078431373,NaN,NaN,NaN,NaN,NaN,NaN,NaN;NaN,NaN,NaN,0.290196078431373,0.290196078431373,NaN,0.290196078431373,1,1,0.290196078431373,0.290196078431373,0.290196078431373,NaN,NaN,NaN,NaN;NaN,NaN,0.290196078431373,1,1,0.290196078431373,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,NaN,NaN,NaN;NaN,NaN,0.290196078431373,1,1,0.290196078431373,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,NaN,0.290196078431373,NaN;NaN,NaN,NaN,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,0.290196078431373,1,0.290196078431373;NaN,NaN,NaN,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373,1,1,0.290196078431373;NaN,0.290196078431373,0.290196078431373,0.290196078431373,0.290196078431373,1,1,1,1,1,1,1,0.290196078431373,1,0.991546501869230,0.290196078431373;0.290196078431373,1,1,0.290196078431373,0.290196078431373,1,1,1,1,1,1,1,0.996032654306859,0.986602578774701,0.975188830395972,0.290196078431373;0.290196078431373,1,1,1,0.290196078431373,1,1,1,1,1,1,0.991546501869230,0.981109330891890,0.968841077286946,0.290196078431373,NaN;NaN,0.290196078431373,1,1,1,1,1,1,1,0.996032654306859,0.986602578774701,0.975188830395972,0.962127107652400,0.947631036850538,0.290196078431373,NaN;NaN,NaN,0.290196078431373,1,1,1,1,1,0.991546501869230,0.981109330891890,0.968871595330739,0.955046921492332,0.939909971770810,0.923643854428931,0.290196078431373,NaN;NaN,NaN,0.290196078431373,1,1,1,0.996063172350652,0.986572060730907,0.975188830395972,0.962127107652400,0.947631036850538,0.931914244296941,0.915190356298161,0.290196078431373,NaN,NaN;NaN,NaN,NaN,0.290196078431373,1,0.991546501869230,0.981109330891890,0.968841077286946,0.955016403448539,0.939909971770810,0.923643854428931,0.906553749904631,0.888761730373083,0.290196078431373,NaN,NaN;NaN,NaN,NaN,NaN,0.290196078431373,0.975188830395972,0.962127107652400,0.947631036850538,0.931914244296941,0.915220874341955,0.897734035248341,0.879728389410239,0.290196078431373,NaN,NaN,NaN;NaN,NaN,NaN,NaN,NaN,0.290196078431373,0.939909971770810,0.923643854428931,0.906553749904631,0.888761730373083,0.870634012359808,0.852231631952392,0.290196078431373,NaN,NaN,NaN;NaN,NaN,NaN,NaN,NaN,0.290196078431373,0.915190356298161,0.897734035248341,0.879758907454032,0.861478599221790,0.843076218814374,0.824887464713512,0.290196078431373,NaN,NaN,NaN;];
4862 icons(idx).data(:,:,2) = <span class="keyword">...</span>
4863     [0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.894102388036927,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894071869993134,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894071869993134,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.882536049439231,0.407843137254902;0.407843137254902,0.894102388036927,0.894102388036927,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.888700694285496,0.875730525673304,0.860105287251087,0.407843137254902;0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.882566567483024,0.868223086900130,0.851468680857557,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.888700694285496,0.875730525673304,0.860105287251087,0.842221713588159,0.822354467078660,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.894102388036927,0.882566567483024,0.868223086900130,0.851468680857557,0.832516975661860,0.811795223926146,0.789547570000763,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.894102388036927,0.894102388036927,0.888700694285496,0.875730525673304,0.860135805294881,0.842221713588159,0.822354467078660,0.800839246204318,0.777950713359274,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.894102388036927,0.882536049439231,0.868223086900130,0.851438162813764,0.832516975661860,0.811764705882353,0.789547570000763,0.766079194323644,0.741756313420310,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.860135805294881,0.842252231631952,0.822384985122454,0.800808728160525,0.777920195315480,0.754024567025254,0.729396505683986,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.811764705882353,0.789547570000763,0.766079194323644,0.741786831464103,0.716914625772488,0.691676203555352,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902,0.777920195315480,0.754024567025254,0.729396505683986,0.704371709773404,0.679133287556268,0.654261081864653,0.407843137254902,0.407843137254902,0.407843137254902,0.407843137254902;];
4864 icons(idx).data(:,:,3) = <span class="keyword">...</span>
4865     [0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799954222934310,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.709803921568628,0.799954222934310,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799954222934310,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.709803921568628,0.799984740978103,0.785091935606928,0.709803921568628;0.709803921568628,0.799954222934310,0.799984740978103,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.792996108949416,0.776272220950637,0.756130312046998,0.709803921568628;0.709803921568628,0.799984740978103,0.799954222934310,0.799984740978103,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.785091935606928,0.766628519111925,0.744960708018616,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799954222934310,0.799984740978103,0.799984740978103,0.799984740978103,0.792996108949416,0.776272220950637,0.756160830090791,0.733089188982986,0.707423514152743,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.799984740978103,0.785091935606928,0.766598001068132,0.744960708018616,0.720546272983902,0.693781948577096,0.665094987411307,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.799984740978103,0.799984740978103,0.792996108949416,0.776241702906844,0.756160830090791,0.733089188982986,0.707423514152743,0.679682612344549,0.650141145952545,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.799984740978103,0.785061417563134,0.766598001068132,0.744960708018616,0.720546272983902,0.693812466620890,0.665094987411307,0.634882124055848,0.603479056992447,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.756160830090791,0.733089188982986,0.707423514152743,0.679652094300755,0.650141145952545,0.619287403677424,0.587518120088502,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.693781948577096,0.665094987411307,0.634882124055848,0.603509575036240,0.571404592965591,0.538872358281834,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628,0.650141145952545,0.619256885633631,0.587518120088502,0.555230029755093,0.522697795071336,0.490638590066377,0.709803921568628,0.709803921568628,0.709803921568628,0.709803921568628;];
4866 <span class="comment">% [EOF] getIcons</span>
4867 
4868 <a name="_sub108" href="#_subfunctions" class="code">function guiparams = createGUIparams</a>
4869 <span class="comment">% Creates the guiparams structure with specified defaults.</span>
4870 
4871 <span class="comment">% Check for any stored prefs</span>
4872 <span class="comment">% --------------------------</span>
4873 <span class="comment">% Currently, units and the graphics renderer are stored as persistent prefs</span>
4874 guiprefs = getpref(<span class="string">'VMT'</span>);
4875 
4876 <span class="comment">% Organized by GUI panels</span>
4877 <span class="comment">%%%%%%%%%%%%%%%%%%%</span>
4878 <span class="comment">% SHIPTRACKS PLOT %</span>
4879 <span class="comment">%%%%%%%%%%%%%%%%%%%</span>
4880 guiparams.horizontal_grid_node_spacing       = 1.0;
4881 guiparams.vertical_grid_node_spacing         = 0.4;
4882 
4883 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%</span>
4884 <span class="comment">% CROSS SECTION PLOT %</span>
4885 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%</span>
4886 guiparams.contours                           = <span class="string">''</span>; <span class="comment">% Set below</span>
4887 guiparams.contour                            = <span class="string">''</span>; <span class="comment">% Set below</span>
4888 guiparams.idx_contour                        = 1;
4889 guiparams.vertical_exaggeration              = 10;
4890 guiparams.vector_scale_cross_section         = 0.2;
4891 guiparams.horizontal_vector_spacing          = 1;
4892 guiparams.vertical_vector_spacing            = 1;
4893 guiparams.horizontal_smoothing_window        = 1;
4894 guiparams.vertical_smoothing_window          = 1;
4895 guiparams.plot_secondary_flow_vectors        = true;
4896 guiparams.secondary_flows                    = <span class="string">''</span>; <span class="comment">% Set below</span>
4897 guiparams.secondary_flow_vector_variable     = <span class="string">''</span>; <span class="comment">% Set below</span>
4898 guiparams.idx_secondary_flow_vector_variable = 1;
4899 guiparams.include_vertical_velocity          = true;
4900 
4901 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
4902 <span class="comment">% PLAN VIEW PLOT %</span>
4903 <span class="comment">%%%%%%%%%%%%%%%%%%</span>
4904 guiparams.depth_range_min                    = 0;
4905 guiparams.depth_range_max                    = inf;
4906 guiparams.vector_scale_plan_view             = 1;
4907 guiparams.vector_spacing_plan_view           = 1;
4908 guiparams.smoothing_window_size              = 1;
4909 guiparams.display_shoreline                  = false;
4910 guiparams.add_background                     = false;
4911 
4912 <span class="comment">%%%%%%%%%%%%%%%</span>
4913 <span class="comment">% DATA EXPORT %</span>
4914 <span class="comment">%%%%%%%%%%%%%%%</span>
4915 guiparams.beam_angle                         = 20.0;
4916 guiparams.magnetic_variation                 = 0.0;
4917 guiparams.wse                                = 0.0;
4918 guiparams.output_auxiliary_data              = false;
4919 
4920 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span>
4921 <span class="comment">% Contour variables %</span>
4922 <span class="comment">%%%%%%%%%%%%%%%%%%%%%</span>
4923 idx = 1;
4924 guiparams.contours(idx).string   = <span class="string">'Streamwise Velocity (u)'</span>;
4925 guiparams.contours(idx).variable = <span class="string">'streamwise'</span>;
4926 idx = idx + 1;
4927 guiparams.contours(idx).string   = <span class="string">'Transverse Velocity (v)'</span>;
4928 guiparams.contours(idx).variable = <span class="string">'transverse'</span>;
4929 idx = idx + 1;
4930 guiparams.contours(idx).string   = <span class="string">'Vertical Velocity (w)'</span>;
4931 guiparams.contours(idx).variable = <span class="string">'vertical'</span>;
4932 idx = idx + 1;
4933 guiparams.contours(idx).string   = <span class="string">'Velocity Magnitude'</span>;
4934 guiparams.contours(idx).variable = <span class="string">'mag'</span>;
4935 idx = idx + 1;
4936 guiparams.contours(idx).string   = <span class="string">'East Velocity (E)'</span>;
4937 guiparams.contours(idx).variable = <span class="string">'east'</span>;
4938 idx = idx + 1;
4939 guiparams.contours(idx).string   = <span class="string">'North Velocity (N)'</span>;
4940 guiparams.contours(idx).variable = <span class="string">'north'</span>;
4941 idx = idx + 1;
4942 guiparams.contours(idx).string   = <span class="string">'Error Velocity'</span>;
4943 guiparams.contours(idx).variable = <span class="string">'error'</span>;
4944 idx = idx + 1;
4945 guiparams.contours(idx).string   = <span class="string">'Primary Velocity (zsd)'</span>;
4946 guiparams.contours(idx).variable = <span class="string">'primary_zsd'</span>;
4947 idx = idx + 1;
4948 guiparams.contours(idx).string   = <span class="string">'Secondary Velocity (zsd)'</span>;
4949 guiparams.contours(idx).variable = <span class="string">'secondary_zsd'</span>;
4950 idx = idx + 1;
4951 guiparams.contours(idx).string   = <span class="string">'Primary Velocity (Roz)'</span>;
4952 guiparams.contours(idx).variable = <span class="string">'primary_roz'</span>;
4953 idx = idx + 1;
4954 guiparams.contours(idx).string   = <span class="string">'Secondary Velocity (Roz)'</span>;
4955 guiparams.contours(idx).variable = <span class="string">'secondary_roz'</span>;
4956 idx = idx + 1;
4957 guiparams.contours(idx).string   = <span class="string">'Prim. Vel. (Roz, Downstream Comp.)'</span>;
4958 guiparams.contours(idx).variable = <span class="string">'primary_roz_x'</span>;
4959 idx = idx + 1;
4960 guiparams.contours(idx).string   = <span class="string">'Prim. Vel. (Roz, Cross-Stream Comp.)'</span>;
4961 guiparams.contours(idx).variable = <span class="string">'primary_roz_y'</span>;
4962 idx = idx + 1;
4963 guiparams.contours(idx).string   = <span class="string">'Sec. Vel. (Roz, Downstream Comp.)'</span>;
4964 guiparams.contours(idx).variable = <span class="string">'secondary_roz_x'</span>;
4965 idx = idx + 1;
4966 guiparams.contours(idx).string   = <span class="string">'Sec. Vel. (Roz, Cross-Stream Comp.)'</span>;
4967 guiparams.contours(idx).variable = <span class="string">'secondary_roz_y'</span>;
4968 idx = idx + 1;
4969 guiparams.contours(idx).string   = <span class="string">'Backscatter'</span>;
4970 guiparams.contours(idx).variable = <span class="string">'backscatter'</span>;
4971 idx = idx + 1;
4972 guiparams.contours(idx).string   = <span class="string">'Flow Direction (deg.)'</span>;
4973 guiparams.contours(idx).variable = <span class="string">'flowangle'</span>;
4974 
4975 guiparams.contour = guiparams.contours(guiparams.idx_contour).variable;
4976 
4977 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
4978 <span class="comment">% Secondary Flow Vector Variables %</span>
4979 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
4980 idx = 1;
4981 guiparams.secondary_flows(idx).string   = <span class="string">'Transverse'</span>;
4982 guiparams.secondary_flows(idx).variable = <span class="string">'transverse'</span>;
4983 idx = idx + 1;
4984 guiparams.secondary_flows(idx).string   = <span class="string">'Secondary (zsd)'</span>;
4985 guiparams.secondary_flows(idx).variable = <span class="string">'secondary_zsd'</span>;
4986 idx = idx + 1;
4987 guiparams.secondary_flows(idx).string   = <span class="string">'Secondary (Roz)'</span>;
4988 guiparams.secondary_flows(idx).variable = <span class="string">'secondary_roz'</span>;
4989 idx = idx + 1;
4990 guiparams.secondary_flows(idx).string   = <span class="string">'Secondary (Roz, Cross-Stream Comp)'</span>;
4991 guiparams.secondary_flows(idx).variable = <span class="string">'secondary_roz_y'</span>;
4992 idx = idx + 1;
4993 guiparams.secondary_flows(idx).string   = <span class="string">'Primary (Roz, Cross-Stream Comp)'</span>;
4994 guiparams.secondary_flows(idx).variable  = <span class="string">'primary_roz_y'</span>;
4995 
4996 guiparams.secondary_flow_vector_variable = <span class="keyword">...</span>
4997     guiparams.secondary_flows(guiparams.idx_secondary_flow_vector_variable).variable;
4998 
4999 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
5000 <span class="comment">% INTERNAL SETTINGS &amp; DEFAULTS %</span>
5001 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
5002 <span class="comment">% Menu bar options</span>
5003 guiparams.presentation                       = true;
5004 guiparams.print                              = false;
5005 guiparams.set_cross_section_endpoints        = false;
5006 guiparams.unit_discharge_correction          = false;
5007 
5008 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'units'</span>)
5009     <span class="keyword">switch</span> guiprefs.units
5010         <span class="keyword">case</span> <span class="string">'metric'</span>
5011             guiparams.english_units          = false;
5012         <span class="keyword">case</span> <span class="string">'english'</span>
5013             guiparams.english_units          = true;
5014     <span class="keyword">end</span>
5015 <span class="keyword">else</span>
5016     guiparams.english_units                  = false;
5017 <span class="keyword">end</span>
5018 guiparams.vertical_offset                    = 0;
5019 
5020 <span class="keyword">if</span> ispref(<span class="string">'VMT'</span>,<span class="string">'renderer'</span>)
5021     guiparams.renderer                       = guiprefs.renderer;
5022 <span class="keyword">else</span>
5023     guiparams.renderer                       = <span class="string">'OpenGL'</span>;
5024 <span class="keyword">end</span>
5025 <span class="comment">% guiparams.plot_ship_tracks                   = false;</span>
5026 <span class="comment">% guiparams.plot_planview                      = false;</span>
5027 <span class="comment">% guiparams.plot_cross_section                 = false;</span>
5028 
5029 <span class="comment">% File location defaults</span>
5030 guiparams.ascii_path                        = pwd;
5031 guiparams.ascii_file                        = <span class="string">''</span>;
5032 guiparams.mat_path                          = pwd;
5033 guiparams.mat_file                          = <span class="string">''</span>;
5034 guiparams.tecplot_path                      = pwd;
5035 guiparams.tecplot_file                      = <span class="string">''</span>;
5036 guiparams.kmz_path                          = pwd;
5037 guiparams.kmz_file                          = <span class="string">''</span>;
5038 guiparams.multibeambathymetry_path          = pwd;
5039 guiparams.multibeambathymetry_file          = <span class="string">''</span>;
5040 guiparams.log_path                          = pwd;
5041 guiparams.log_file                          = <span class="string">''</span>;
5042 <span class="comment">% Avoids problems of not finding the MCR root when running as a standalone</span>
5043 <span class="comment">% application</span>
5044 <span class="keyword">if</span> isdeployed 
5045     guiparams.has_mapping_toolbox           = true;
5046 <span class="keyword">else</span>
5047     guiparams.has_mapping_toolbox               = <span class="keyword">...</span>
5048         ~isempty(dir(fullfile(matlabroot,<span class="string">'toolbox'</span>,<span class="string">'map'</span>)));
5049 <span class="keyword">end</span>
5050 
5051 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
5052 <span class="comment">% IN MEMORY DATA STORAGE %</span>
5053 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%</span>
5054 guiparams.z                      = [];
5055 guiparams.A                      = [];
5056 guiparams.V                      = [];
5057 guiparams.Map                    = [];
5058 guiparams.savefile               = [];
5059 guiparams.iric_anv_planview_data = [];
5060 <span class="comment">% guiparams.zmin = []; % Don't need to store these?</span>
5061 <span class="comment">% guiparams.zmax = [];</span>
5062 <span class="comment">% guiprefs = getappdata(handles.figure1,'guiprefs');</span>
5063 guiparams.data_folder = <span class="string">''</span>;
5064 guiparams.data_files  = {<span class="string">''</span>};
5065 guiparams.gui_state   = <span class="string">'init'</span>;
5066 
5067 <span class="comment">% [EOF] createGUIparams</span>
5068 
5069 <a name="_sub109" href="#_subfunctions" class="code">function ShiptracksZoom_Callback(obj,evd,handles)</a>
5070 ticks_format(<span class="string">'%6.0f'</span>,<span class="string">'%8.0f'</span>); <span class="comment">%formats the ticks for UTM (when zooming)</span>
5071 
5072 <a name="_sub110" href="#_subfunctions" class="code">function ShiptracksPan_Callback(obj,evd,handles)</a>
5073 ticks_format(<span class="string">'%6.0f'</span>,<span class="string">'%8.0f'</span>); <span class="comment">%formats the ticks for UTM (when panning)</span>
5074 
5075 <span class="comment">% [EOF] VMT</span>
5076 
5077 
5078 
5079 
5080 
5081 <span class="comment">% --- Hidden keyboard commands</span>
5082 <a name="_sub111" href="#_subfunctions" class="code">function figure1_WindowKeyPressFcn(hObject, eventdata, handles)</a>
5083 <span class="comment">% Used to pass specific hidden keyboard commands to VMT. Currently, the</span>
5084 <span class="comment">% only use for this function is to open Beta support for SonTek M9 data.</span>
5085 <span class="comment">%</span>
5086 <span class="comment">% hObject    handle to figure1 (see GCBO)</span>
5087 <span class="comment">% eventdata  structure with the following fields (see FIGURE)</span>
5088 <span class="comment">%    Key: name of the key that was pressed, in lower case</span>
5089 <span class="comment">%    Character: character interpretation of the key(s) that was pressed</span>
5090 <span class="comment">%    Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed</span>
5091 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
5092 
5093 in1 = eventdata.Modifier; 
5094 in2 = eventdata.Key;
5095 
5096 <span class="keyword">if</span> ~isempty(in1) <span class="comment">% User pressed at least one modifier key</span>
5097     input = [in1{:} in2];
5098 <span class="keyword">else</span>
5099     input = in2;
5100 <span class="keyword">end</span>
5101 
5102 <span class="keyword">switch</span> input
5103     <span class="comment">% Hidden SonTek M9 support</span>
5104     <span class="keyword">case</span> <span class="string">'shiftcontrols'</span>
5105         msgtxt = {<span class="keyword">...</span>
5106             <span class="string">'VMT offers limited support for SonTek M9/S5 data.'</span>;<span class="keyword">...</span>
5107             <span class="string">'SonTek RiverSurveyorLive required data format:'</span>;<span class="keyword">...</span>
5108             <span class="string">'      -ENU coordinates'</span>;<span class="keyword">...</span>
5109             <span class="string">'      -Desired GPS reference (BT/GGA/VTG)'</span>
5110             <span class="string">''</span>;<span class="keyword">...</span>
5111             <span class="string">'Abosolutely NO GUARANTEE is made or implied that this'</span>;<span class="keyword">...</span>
5112             <span class="string">'functionality will work for all cases. Results are'</span>;<span class="keyword">...</span>
5113             <span class="string">'PROVISIONAL at best.'</span>};
5114         msgbox(msgtxt, <span class="string">'Hidden Functionality: Process SonTek M9'</span>, <span class="string">'warn'</span>,<span class="string">'replace'</span>)
5115         
5116         <span class="comment">% Get the Application data:</span>
5117         <span class="comment">% -------------------------</span>
5118         guiparams = getappdata(handles.figure1,<span class="string">'guiparams'</span>);
5119         guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
5120         
5121         <span class="comment">% Ask the user to select files:</span>
5122         <span class="comment">% -----------------------------</span>
5123         <span class="comment">% current_file = fullfile(guiparams.data_folder,guiparams.data_files{1});</span>
5124         <span class="comment">% current_file = fullfile(guiprefs.mat_path,guiprefs.mat_file);</span>
5125         <span class="keyword">if</span> iscell(guiprefs.mat_file)
5126             uifile = fullfile(guiprefs.mat_path,guiprefs.mat_file{1});
5127         <span class="keyword">else</span>
5128             uifile = fullfile(guiprefs.mat_path,guiprefs.mat_file);
5129         <span class="keyword">end</span>
5130         [filename,pathname] = <span class="keyword">...</span>
5131             uigetfile({<span class="string">'*.mat'</span>,<span class="string">'MAT-files (*.mat)'</span>}, <span class="keyword">...</span>
5132             <span class="string">'Select SonTek RiverSurveyor Live v3.60 MAT File'</span>, <span class="keyword">...</span>
5133             uifile, <span class="string">'MultiSelect'</span>,<span class="string">'on'</span>);
5134         
5135         <span class="keyword">if</span> ischar(pathname) <span class="comment">% The user did not hit &quot;Cancel&quot;</span>
5136             guiparams.data_folder = pathname;
5137             <span class="keyword">if</span> ischar(filename)
5138                 filename = {filename};
5139             <span class="keyword">end</span>
5140             guiparams.data_files = filename;
5141             guiparams.mat_file = <span class="string">''</span>;
5142             
5143             setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
5144             
5145             
5146             
5147             <span class="comment">% Update the preferences:</span>
5148             <span class="comment">% -----------------------</span>
5149             guiprefs = getappdata(handles.figure1,<span class="string">'guiprefs'</span>);
5150             guiprefs.ascii_path = pathname;
5151             guiprefs.ascii_file = filename;
5152             setappdata(handles.figure1,<span class="string">'guiprefs'</span>,guiprefs)
5153             <a href="#_sub93" class="code" title="subfunction store_prefs(hfigure,pref)">store_prefs</a>(handles.figure1,<span class="string">'ascii'</span>)
5154             
5155             <span class="comment">% Push messages to Log Window:</span>
5156             <span class="comment">% ----------------------------</span>
5157             log_text = {<span class="keyword">...</span>
5158                 <span class="string">''</span>;<span class="keyword">...</span>
5159                 [<span class="string">'%--- '</span> datestr(now) <span class="string">' ---%'</span>];<span class="keyword">...</span>
5160                 <span class="string">'Current Project Directory:'</span>;<span class="keyword">...</span>
5161                 guiparams.data_folder;
5162                 <span class="string">'Loading the following files into memory:'</span>;<span class="keyword">...</span>
5163                 char(filename)};
5164             statusLogging(handles.LogWindow, log_text)
5165             
5166             <span class="comment">% Read the file(s)</span>
5167             <span class="comment">% ----------------</span>
5168             <span class="comment">%A = parseSonTekVMT(fullfile(pathname,filename));</span>
5169             
5170             [~,~,savefile,A,z] = <span class="keyword">...</span>
5171                 <a href="VMT_ReadFiles_SonTek.html" class="code" title="function [zPathName,zFileName,savefile,A,z] = VMT_ReadFiles_SonTek(zPathName,zFileName)">VMT_ReadFiles_SonTek</a>(guiparams.data_folder,guiparams.data_files);
5172             guiparams.savefile = savefile;
5173             guiparams.A        = A;
5174             guiparams.z        = z;
5175             setappdata(handles.figure1,<span class="string">'guiparams'</span>,guiparams)
5176             
5177             
5178             <span class="comment">% Update the GUI:</span>
5179             <span class="comment">% ---------------</span>
5180             <a href="#_sub95" class="code" title="subfunction set_enable(handles,enable_state)">set_enable</a>(handles,<span class="string">'fileloaded'</span>)
5181         <span class="keyword">end</span>  
5182     <span class="keyword">case</span> <span class="string">'f1'</span> <span class="comment">% Call the VMT UsersGuide</span>
5183         <a href="#_sub46" class="code" title="subfunction menuUsersGuide_Callback(hObject, eventdata, handles)">menuUsersGuide_Callback</a>(hObject, eventdata, handles)
5184         
5185     <span class="keyword">case</span> <span class="string">'controlalte'</span>
5186         VMT_BuildCustomFlatFile;
5187     <span class="keyword">otherwise</span>
5188         <span class="comment">%disp(input)</span>
5189 <span class="keyword">end</span>
5190 
5191 
5192 
5193</pre></div>
<hr><address>Generated on Wed 04-Jun-2014 14:21:02 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>